Sha256: 2ec0d95af528333b3c57428ba6aeff942cc7c115b4b12bfced75afd8261e5af7
Contents?: true
Size: 635 Bytes
Versions: 11
Compression:
Stored size: 635 Bytes
Contents
module Neo4j module Core class Result attr_reader :columns, :rows def initialize(columns, rows) @columns = columns.map(&:to_sym) @rows = rows @struct_class = Struct.new(:index, *@columns) end include Enumerable def each structs.each do |struct| yield struct end end def structs @structs ||= rows.each_with_index.map do |row, index| @struct_class.new(index, *row) end end def hashes @hashes ||= rows.map do |row| Hash[@columns.zip(row)] end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems