Class: ActiveNode::Graph::Builder
- Inherits:
-
Object
- Object
- ActiveNode::Graph::Builder
- Includes:
- Neography::Rest::Helpers
- Defined in:
- lib/active_node/graph/builder.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
-
#reflections ⇒ Object
readonly
Returns the value of attribute reflections.
Instance Method Summary collapse
- #build(*objects) ⇒ Object
-
#initialize(klass, *includes) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(klass, *includes) ⇒ Builder
Returns a new instance of Builder.
8 9 10 11 12 13 14 15 16 |
# File 'lib/active_node/graph/builder.rb', line 8 def initialize klass, *includes @klass = klass if klass < ActiveNode::Base @matches = [] @reflections =[] @object_cache = {} @relationship_cache = {} @loaded_assoc_cache = {} parse_paths(:n0, klass, includes) end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
6 7 8 |
# File 'lib/active_node/graph/builder.rb', line 6 def klass @klass end |
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
6 7 8 |
# File 'lib/active_node/graph/builder.rb', line 6 def matches @matches end |
#reflections ⇒ Object (readonly)
Returns the value of attribute reflections.
6 7 8 |
# File 'lib/active_node/graph/builder.rb', line 6 def reflections @reflections end |
Instance Method Details
#build(*objects) ⇒ Object
18 19 20 21 22 |
# File 'lib/active_node/graph/builder.rb', line 18 def build *objects ids = objects.map { |o| o.is_a?(ActiveNode::Base) ? o.id.tap { |id| @object_cache[id]=o } : extract_id(o) } parse_results execute(ids.compact) @object_cache.slice(*ids).values end |