Module: ActiveGraph::Core::Result
- Defined in:
- lib/active_graph/core/result.rb
Instance Attribute Summary collapse
-
#wrap ⇒ Object
writeonly
Sets the attribute wrap.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #keys ⇒ Object
- #store ⇒ Object
-
#to_a ⇒ Object
To avoid to_a on Neo4j::Driver::Result as that one does not call the above block.
- #wrap? ⇒ Boolean
Instance Attribute Details
#wrap=(value) ⇒ Object (writeonly)
Sets the attribute wrap
4 5 6 |
# File 'lib/active_graph/core/result.rb', line 4 def wrap=(value) @wrap = value end |
Instance Method Details
#each(&block) ⇒ Object
14 15 16 17 |
# File 'lib/active_graph/core/result.rb', line 14 def each(&block) store if wrap? # TODO: why? This is preventing streaming @records&.each(&block) || super end |
#keys ⇒ Object
6 7 8 |
# File 'lib/active_graph/core/result.rb', line 6 def keys @keys ||= super end |
#store ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/active_graph/core/result.rb', line 24 def store return if @records keys @records = [] # TODO: implement 'each' without block parameter method(:each).super_method.call do |record| record.wrap = wrap? @records << record end end |
#to_a ⇒ Object
To avoid to_a on Neo4j::Driver::Result as that one does not call the above block
20 21 22 |
# File 'lib/active_graph/core/result.rb', line 20 def to_a map.to_a end |
#wrap? ⇒ Boolean
10 11 12 |
# File 'lib/active_graph/core/result.rb', line 10 def wrap? @wrap end |