Sha256: 9a92be0d168f26f0339af2a2c5ccfa4c2fff7091adf24471738530945aec4221

Contents?: true

Size: 714 Bytes

Versions: 8

Compression:

Stored size: 714 Bytes

Contents

module ActiveGraph
  module Core
    module Record
      attr_writer :wrap

      def values
        wrap(super)
      end

      def first
        wrap(super)
      end

      def [](key)
        wrap(super)
      end

      def to_h
        wrap(super)
      end

      private

      def wrap(value)
        return value unless wrap?

        case value
        when Neo4j::Driver::Types::Entity
          value.wrap
        when Neo4j::Driver::Types::Path
          value
        when Hash
          value.transform_values(&method(:wrap))
        when Enumerable
          value.map!(&method(:wrap))
        else
          value
        end
      end

      def wrap?
        @wrap
      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/record.rb
activegraph-11.5.0.beta.3 lib/active_graph/core/record.rb
activegraph-12.0.0.beta.3 lib/active_graph/core/record.rb
activegraph-12.0.0.beta.2 lib/active_graph/core/record.rb
activegraph-11.5.0.beta.2 lib/active_graph/core/record.rb
activegraph-12.0.0.beta.1 lib/active_graph/core/record.rb
activegraph-11.5.0.beta.1 lib/active_graph/core/record.rb
activegraph-11.5.0.alpha.1 lib/active_graph/core/record.rb