Sha256: b73af843d3dddc2e5385e3fc5851cd55c2d46696bba0b148a98a625c8b6c13b7

Contents?: true

Size: 725 Bytes

Versions: 8

Compression:

Stored size: 725 Bytes

Contents

module ActiveGraph
  module Core
    module Result
      attr_writer :wrap

      def keys
        @keys ||= super
      end

      def wrap?
        @wrap
      end

      def each(&block)
        store if wrap? # TODO: why? This is preventing streaming
        @records&.each(&block) || super
      end

      ## To avoid to_a on Neo4j::Driver::Result as that one does not call the above block
      def to_a
        map.to_a
      end

      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activegraph-12.0.0.beta.4 lib/active_graph/core/result.rb
activegraph-11.5.0.beta.3 lib/active_graph/core/result.rb
activegraph-12.0.0.beta.3 lib/active_graph/core/result.rb
activegraph-12.0.0.beta.2 lib/active_graph/core/result.rb
activegraph-11.5.0.beta.2 lib/active_graph/core/result.rb
activegraph-12.0.0.beta.1 lib/active_graph/core/result.rb
activegraph-11.5.0.beta.1 lib/active_graph/core/result.rb
activegraph-11.5.0.alpha.1 lib/active_graph/core/result.rb