class Axiom::Adapter::Arango::Visitor::For::Unary::Rename

Visitor for emitting renames

Constants

LOCAL_NAME

Private Instance Methods

body() click to toggle source

Return for body

@return [AQL::Node]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/rename.rb, line 32
def body
  return_operation
end
document_attribute(attribute) click to toggle source

Return document attribute

@param [Attribute] attribute

@return [Node::Literal::Composed::Document::Attribute]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/rename.rb, line 56
def document_attribute(attribute)
  key = Node::Literal::Primitive::String.new(attribute.name.to_s)
  Node::Literal::Composed::Document::Attribute.new(key, document_attribute_value(attribute))
end
document_attribute_value(attribute) click to toggle source

Return document attribute value

@return [AQL::Node]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/rename.rb, line 78
def document_attribute_value(attribute)
  visit(inverse[attribute])
end
inverse() click to toggle source

Return inverse of aliases

@return [Algebra::Rename::Aliases]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/rename.rb, line 67
def inverse
  input.aliases.inverse
end
renamed_attributes() click to toggle source

Return renamed attributes

@return [Enumerable<AQL::Node::Literal::Composed::Document::Attribute>]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/rename.rb, line 42
def renamed_attributes
  input.header.map do |attribute|
    document_attribute(attribute)
  end
end
return_value() click to toggle source

Return return value

@return [AQL::Node::Literal::Composed::Document]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/rename.rb, line 22
def return_value
  Node::Literal::Composed::Document.new(renamed_attributes)
end