Module: ActiveGraph::Core::Result

Defined in:
lib/active_graph/core/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#wrap=(value) ⇒ Object (writeonly)

Sets the attribute wrap

Parameters:

  • value

    the value to set the attribute wrap to.



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

#keysObject



6
7
8
# File 'lib/active_graph/core/result.rb', line 6

def keys
  @keys ||= super
end

#storeObject



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_aObject

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

Returns:

  • (Boolean)


10
11
12
# File 'lib/active_graph/core/result.rb', line 10

def wrap?
  @wrap
end