Sha256: 950b4463f209ab4ed44a6c3e0bd159955590d3a8b879d406dd1a7345d905302a
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
module Axiom module Adapter module Arango # A reader to read tuples from the database class Reader include Adamantium::Flat, Enumerable, Concord.new(:adapter, :relation) # Enumerate tuples # # @return [self] # if block given # # @return [Enumerable<Tuple>] # otherwise # # @api private # def each return to_enum unless block_given? cursor.each do |document| yield tuple(document) end self end private # Coerce document to tuple # # @param [Ashikawa::Core::Document] document # # @return [Tuple] # # @api private # def tuple(document) Tuple.new(header, document.to_hash.values_at(*document_keys)) end # Return header # # @return [Relation::Header] # # @api private # def header relation.header end # Return attribute names # # @return [Enumerable<Symbol>] # # @api private # def attribute_names header.map(&:name) end # Return document keys # # @return [Enumerable<String>] # # @api private # def document_keys attribute_names.map(&:to_s) end memoize :document_keys # Return cursor # # @return [Ashikawa::Core::Cursor] # # @api private # def cursor adapter.database.query.execute(aql) end # Return AQL to query with # # @return [String] # # @api private # def aql aql = Visitor.run(relation).aql adapter.logger.debug { "AQL: #{aql}" } aql end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
axiom-arango-adapter-0.0.2 | lib/axiom/adapter/arango/reader.rb |
axiom-arango-adapter-0.0.1 | lib/axiom/adapter/arango/reader.rb |