Sha256: e7c26b3d7ff5fde989495b8d1243f0ccbb0b8bad9556e0eb612e1a8d29ec9ef1

Contents?: true

Size: 554 Bytes

Versions: 12

Compression:

Stored size: 554 Bytes

Contents

module ActiveGraph
  module Core
    module Result
      attr_writer :wrap

      def wrap?
        @wrap
      end

      def each(&block)
        wrap? ? wrapping_each(&block) : super
      end

      private

      def wrapping_each(&block)
        if @records
          @records.each(&block)
        else
          @records = []
          method(:each).super_method.call do |record|
            record.wrap = wrap?
            @records << record
            block_given? ? yield(record) : record
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activegraph-10.2.0.beta.1 lib/active_graph/core/result.rb
activegraph-10.1.1 lib/active_graph/core/result.rb
activegraph-10.1.0 lib/active_graph/core/result.rb
activegraph-10.0.2 lib/active_graph/core/result.rb
activegraph-10.0.1 lib/active_graph/core/result.rb
activegraph-10.0.0 lib/active_graph/core/result.rb
activegraph-10.0.0.pre.beta.11 lib/active_graph/core/result.rb
activegraph-10.0.0.pre.beta.10 lib/active_graph/core/result.rb
activegraph-10.0.0.pre.beta.9 lib/active_graph/core/result.rb
activegraph-10.0.0.pre.beta.8 lib/active_graph/core/result.rb
activegraph-10.0.0.pre.beta.7 lib/active_graph/core/result.rb
activegraph-10.0.0.pre.beta.6 lib/active_graph/core/result.rb