Class: Flock::SimpleOperation
- Inherits:
-
SelectOperation
- Object
- SelectOperation
- Flock::SimpleOperation
- Defined in:
- lib/flock/operations/simple_operation.rb
Instance Method Summary collapse
- #edges ⇒ Object
-
#initialize(client, query) ⇒ SimpleOperation
constructor
A new instance of SimpleOperation.
- #to_thrift ⇒ Object
- #to_thrift_edges ⇒ Object
Methods inherited from SelectOperation
#difference, #get_results, #intersect, #operation, #size, #union
Methods included from Mixins::Sizeable
Constructor Details
#initialize(client, query) ⇒ SimpleOperation
Returns a new instance of SimpleOperation.
3 4 5 6 |
# File 'lib/flock/operations/simple_operation.rb', line 3 def initialize(client, query) super(client) @term = query end |
Instance Method Details
#edges ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/flock/operations/simple_operation.rb', line 8 def edges Flock::Operation.new do |page| query = to_thrift_edges query.page = page result = @service.select_edges(Array(query)).first [result.edges, result.next_cursor, result.prev_cursor] end end |
#to_thrift ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/flock/operations/simple_operation.rb', line 17 def to_thrift operation = Edges::SelectOperation.new operation.operation_type = Edges::SelectOperationType::SimpleQuery operation.term = @term.to_thrift Array(operation) end |