Module: Related::Node::QueryMethods
- Included in:
- Related::Node, Query
- Defined in:
- lib/related/node.rb
Instance Method Summary collapse
- #depth(depth) ⇒ Object
- #include_start_node ⇒ Object
- #incoming(type) ⇒ Object
- #limit(count) ⇒ Object
- #nodes ⇒ Object
- #options(opt) ⇒ Object
- #outgoing(type) ⇒ Object
- #page(nr) ⇒ Object
- #path_to(node) ⇒ Object
- #per_page(count) ⇒ Object
- #relationships ⇒ Object
- #shortest_path_to(node) ⇒ Object
Instance Method Details
#depth(depth) ⇒ Object
53 54 55 56 57 |
# File 'lib/related/node.rb', line 53 def depth(depth) query = self.query query.depth = depth query end |
#include_start_node ⇒ Object
59 60 61 62 63 |
# File 'lib/related/node.rb', line 59 def include_start_node query = self.query query.include_start_node = true query end |
#incoming(type) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/related/node.rb', line 29 def incoming(type) query = self.query query.relationship_type = type query.direction = :in query end |
#limit(count) ⇒ Object
36 37 38 39 40 |
# File 'lib/related/node.rb', line 36 def limit(count) query = self.query query.limit = count query end |
#nodes ⇒ Object
10 11 12 13 14 |
# File 'lib/related/node.rb', line 10 def nodes query = self.query query.result_type = :nodes query end |
#options(opt) ⇒ Object
16 17 18 19 20 |
# File 'lib/related/node.rb', line 16 def (opt) query = self.query query. = opt query end |
#outgoing(type) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/related/node.rb', line 22 def outgoing(type) query = self.query query.relationship_type = type query.direction = :out query end |
#page(nr) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/related/node.rb', line 46 def page(nr) query = self.query query.page = nr query.result_type = :relationships query end |
#path_to(node) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/related/node.rb', line 65 def path_to(node) query = self.query query.destination = node query.search_algorithm = :depth_first query end |
#per_page(count) ⇒ Object
42 43 44 |
# File 'lib/related/node.rb', line 42 def per_page(count) self.limit(count) end |
#relationships ⇒ Object
4 5 6 7 8 |
# File 'lib/related/node.rb', line 4 def relationships query = self.query query.result_type = :relationships query end |
#shortest_path_to(node) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/related/node.rb', line 72 def shortest_path_to(node) query = self.query query.destination = node query.search_algorithm = :dijkstra query end |