class Mongo::Cursor::Builder::OpKillCursors
Encapsulates behaviour around generating an OP_KILL_CURSORS specification.
@since 2.2.0
Attributes
cursor[R]
@return [ Cursor
] cursor The cursor.
Public Class Methods
get_cursors_list(spec)
click to toggle source
Get the list of cursor ids from a spec generated by this Builder
.
@example Get the list of cursor ids.
OpKillCursors.cursors(spec)
@return [ Hash ] The specification.
@since 2.3.0
# File lib/mongo/cursor/builder/op_kill_cursors.rb, line 77 def get_cursors_list(spec) spec[:cursor_ids] end
new(cursor)
click to toggle source
Create the new builder.
@example Create the builder.
OpKillCursors.new(cursor)
@param [ Cursor
] cursor The cursor.
@since 2.2.0
# File lib/mongo/cursor/builder/op_kill_cursors.rb, line 38 def initialize(cursor) @cursor = cursor end
update_cursors(spec, ids)
click to toggle source
Update a specification's list of cursor ids.
@example Update a specification's list of cursor ids.
OpKillCursors.update_cursors(spec, ids)
@return [ Hash ] The specification. @return [ Array ] The ids to update with.
@since 2.3.0
# File lib/mongo/cursor/builder/op_kill_cursors.rb, line 65 def update_cursors(spec, ids) spec.merge!(cursor_ids: spec[:cursor_ids] & ids) end
Public Instance Methods
specification()
click to toggle source
Get the specification.
@example Get the specification.
op_kill_cursors.specification
@return [ Hash ] The specification.
@since 2.2.0
# File lib/mongo/cursor/builder/op_kill_cursors.rb, line 50 def specification { :coll_name => collection_name, :db_name => database.name, :cursor_ids => [ cursor.id ] } end