Sha256: 61e0e6be36afb0233327ea952087871441ac754282724401776f6f5352d4585c

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

module Axiom
  module Adapter
    module Arango
      class Visitor
        # Base class for visitors that emit for statements
        class For < self

          # Return root AQL AST
          #
          # @return [AQL::Node]
          #
          # @api private
          #
          def root
            Node::Operation::For.new(local_name, source, body)
          end
          memoize :root

          # Return local name
          #
          # @return [AQL::Node::Name]
          #
          # @api private
          #
          def local_name
            self.class::LOCAL_NAME
          end

        private

          # Return source
          #
          # @return [AQL::Node]
          #
          # @api private
          #
          def source
            visit(input.operand)
          end

          # Return body
          #
          # @return [AQL::Node]
          #
          # @api private
          #
          def body
            return_operation
          end

          # Return return operation
          #
          # @return [AQL::Node::Operation::Return]
          #
          # @api private
          #
          def return_operation
            Node::Operation::Unary::Return.new(return_value)
          end

          # Return return value
          #
          # @return [AQL::Node::Literal::Composed::Document]
          #
          # @api private
          #
          def return_value
            visit(input.header)
          end

        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/visitor/for.rb
axiom-arango-adapter-0.0.1 lib/axiom/adapter/arango/visitor/for.rb