Class: Flock::SimpleOperation
Instance Method Summary
collapse
#difference, #get_results, #intersect, #operation, #size, #union
#any?, #empty?
Constructor Details
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
|
#to_thrift_edges ⇒ Object
25
26
27
28
29
|
# File 'lib/flock/operations/simple_operation.rb', line 25
def to_thrift_edges
query = Edges::EdgeQuery.new
query.term = @term.to_thrift
query
end
|