class Axiom::Adapter::Arango::Reader

A reader to read tuples from the database

Public Instance Methods

each() { |tuple(document)| ... } click to toggle source

Enumerate tuples

@return [self]

if block given

@return [Enumerable<Tuple>]

otherwise

@api private

# File lib/axiom/adapter/arango/reader.rb, line 18
def each
  return to_enum unless block_given?

  cursor.each do |document|
    yield tuple(document)
  end

  self
end

Private Instance Methods

aql() click to toggle source

Return AQL to query with

@return [String]

@api private

# File lib/axiom/adapter/arango/reader.rb, line 89
def aql
  aql = Visitor.run(relation).aql
  adapter.logger.debug { "AQL: #{aql}" }
  aql
end
attribute_names() click to toggle source

Return attribute names

@return [Enumerable<Symbol>]

@api private

# File lib/axiom/adapter/arango/reader.rb, line 58
def attribute_names
  header.map(&:name)
end
cursor() click to toggle source

Return cursor

@return [Ashikawa::Core::Cursor]

@api private

# File lib/axiom/adapter/arango/reader.rb, line 79
def cursor
  adapter.database.query.execute(aql)
end
document_keys() click to toggle source

Return document keys

@return [Enumerable<String>]

@api private

# File lib/axiom/adapter/arango/reader.rb, line 68
def document_keys
  attribute_names.map(&:to_s)
end
header() click to toggle source

Return header

@return [Relation::Header]

@api private

# File lib/axiom/adapter/arango/reader.rb, line 48
def header
  relation.header
end
tuple(document) click to toggle source

Coerce document to tuple

@param [Ashikawa::Core::Document] document

@return [Tuple]

@api private

# File lib/axiom/adapter/arango/reader.rb, line 38
def tuple(document)
  Tuple.new(header, document.to_hash.values_at(*document_keys))
end