Class: Flock::SelectOperation
- Inherits:
-
Object
- Object
- Flock::SelectOperation
- Includes:
- Enumerable, Mixins::Sizeable
- Defined in:
- lib/flock/operations/select_operation.rb
Direct Known Subclasses
Instance Method Summary collapse
- #difference(*args) ⇒ Object
- #get_results(page) ⇒ Object
-
#initialize(client) ⇒ SelectOperation
constructor
A new instance of SelectOperation.
- #intersect(*args) ⇒ Object
- #operation ⇒ Object
- #size ⇒ Object
- #union(*args) ⇒ Object
Methods included from Mixins::Sizeable
Constructor Details
#initialize(client) ⇒ SelectOperation
Returns a new instance of SelectOperation.
11 12 13 14 |
# File 'lib/flock/operations/select_operation.rb', line 11 def initialize(client) @client = client @service = client.service end |
Instance Method Details
#difference(*args) ⇒ Object
26 27 28 29 |
# File 'lib/flock/operations/select_operation.rb', line 26 def difference(*args) other = _operation_from_args(args) ComplexOperation.new(@client, Edges::SelectOperationType::Difference, self, other) end |
#get_results(page) ⇒ Object
31 32 33 |
# File 'lib/flock/operations/select_operation.rb', line 31 def get_results(page) @service.select(to_thrift, page) end |
#intersect(*args) ⇒ Object
16 17 18 19 |
# File 'lib/flock/operations/select_operation.rb', line 16 def intersect(*args) other = _operation_from_args(args) ComplexOperation.new(@client, Edges::SelectOperationType::Intersection, self, other) end |
#operation ⇒ Object
39 40 41 42 43 44 |
# File 'lib/flock/operations/select_operation.rb', line 39 def operation Flock::Operation.new do |page| results = get_results(page) [results.ids.unpack("Q*"), results.next_cursor, results.prev_cursor] end end |
#size ⇒ Object
35 36 37 |
# File 'lib/flock/operations/select_operation.rb', line 35 def size @service.count(to_thrift) end |
#union(*args) ⇒ Object
21 22 23 24 |
# File 'lib/flock/operations/select_operation.rb', line 21 def union(*args) other = _operation_from_args(args) ComplexOperation.new(@client, Edges::SelectOperationType::Union, self, other) end |