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



19
20
21
22
23
24
25
26
27
28
# File 'lib/active_graph/core/result.rb', line 19

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

#wrap?Boolean

Returns:

  • (Boolean)


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

def wrap?
  @wrap
end