Class: Rebat::Selector
- Inherits:
-
Object
- Object
- Rebat::Selector
- Defined in:
- lib/rebat/selector.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #entries ⇒ Object
- #exclude(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
-
#initialize(client) ⇒ Selector
constructor
A new instance of Selector.
- #intersect(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
- #union(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
- #where(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
Constructor Details
#initialize(client) ⇒ Selector
Returns a new instance of Selector.
4 5 6 7 |
# File 'lib/rebat/selector.rb', line 4 def initialize(client) @client = client @query_list = [] end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
2 3 4 |
# File 'lib/rebat/selector.rb', line 2 def client @client end |
Instance Method Details
#entries ⇒ Object
29 30 31 32 33 |
# File 'lib/rebat/selector.rb', line 29 def entries @client.sendQuery do |client| return client.selectQuery(@query_list) end end |
#exclude(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
24 25 26 27 |
# File 'lib/rebat/selector.rb', line 24 def exclude(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) @query_list << create_query(from_entity_id, from_entity_type, to_entity_id, to_entity_type, @client.relations[relation_key], Rebat::Thrift::QueryType::EXCLUDE) return self end |
#intersect(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
19 20 21 22 |
# File 'lib/rebat/selector.rb', line 19 def intersect(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) @query_list << create_query(from_entity_id, from_entity_type, to_entity_id, to_entity_type, @client.relations[relation_key], Rebat::Thrift::QueryType::INTERSECT) return self end |
#union(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
14 15 16 17 |
# File 'lib/rebat/selector.rb', line 14 def union(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) @query_list << create_query(from_entity_id, from_entity_type, to_entity_id, to_entity_type, @client.relations[relation_key], Rebat::Thrift::QueryType::UNION) return self end |
#where(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) ⇒ Object
9 10 11 12 |
# File 'lib/rebat/selector.rb', line 9 def where(from_entity_id, from_entity_type, to_entity_id, to_entity_type, relation_key) @query_list << create_query(from_entity_id, from_entity_type, to_entity_id, to_entity_type, @client.relations[relation_key], Rebat::Thrift::QueryType::WHERE) return self end |