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

Visitor for emitting extensions

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/extension.rb, line 22
def body
  return_operation
end
document_attribute(attribute, function) click to toggle source

Return document attribute

@param [Axiom::Attribute] attribute @param [Axiom::Function] function

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

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/extension.rb, line 59
def document_attribute(attribute, function)
  Node::Literal::Composed::Document::Attribute.new(
    Node::Literal::Primitive::String.new(attribute.name.to_s),
    visit(function)
  )
end
extended_attributes() click to toggle source

Return document attribute node

@return [Axiom::Attribute] attribute

@return [AQL::Node]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/extension.rb, line 44
def extended_attributes
  input.extensions.map do |attribute, function|
    document_attribute(attribute, function)
  end
end
return_value() click to toggle source

Return return value

@return [AQL::Node::Call]

@api private

# File lib/axiom/adapter/arango/visitor/for/unary/extension.rb, line 32
def return_value
  Node::Call.new('MERGE', [local_name, Node::Literal::Composed::Document.new(extended_attributes)])
end