Sha256: 868396bafa1e9f410b19dbb7285ee07e812273fb679d788d07555a2be017a8a9
Contents?: true
Size: 1.06 KB
Versions: 11
Compression:
Stored size: 1.06 KB
Contents
require 'neo4j/core/result' require 'active_support/core_ext/module/attribute_accessors' module Neo4j module Core module Responses extend ActiveSupport::Concern included do mattr_accessor :wrap_level end class_methods do def result_from_data(entities_data) rows = entities_data.map do |entity_data| wrap(entity_data.values) end Neo4j::Core::Result.new(entities_data.keys, rows) end private def wrap(value) case value when Neo4j::Driver::Types::Entity wrap_by_level(value) when Neo4j::Driver::Types::Path value when Hash value.map { |key, val| [key, wrap(val)] }.to_h when Enumerable value.map(&method(:wrap)) else value end end def wrap_by_level(entity) case wrap_level when :core_entity entity else entity.wrap end end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems