Class: AQL::Node::Literal

Inherits:
AQL::Node show all
Defined in:
lib/aql/node/literal.rb,
lib/aql/node/literal/composed.rb,
lib/aql/node/literal/primitive.rb,
lib/aql/node/literal/singleton.rb,
lib/aql/node/literal/composed/list.rb,
lib/aql/node/literal/primitive/number.rb,
lib/aql/node/literal/primitive/string.rb,
lib/aql/node/literal/composed/document.rb

Overview

Abstract base class for literal nodes

Defined Under Namespace

Classes: Composed, Primitive, Singleton

Constant Summary collapse

REGISTRY =
{}

Constants inherited from AQL::Node

NULL

Class Method Summary collapse

Methods inherited from AQL::Node

#aql, #visit

Class Method Details

.build(object) ⇒ Node::Literal

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build literal handler

Parameters:

  • object (Object)

Returns:



28
29
30
31
32
33
34
# File 'lib/aql/node/literal.rb', line 28

def self.build(object)
  klass = object.class
  handler = REGISTRY.fetch(klass) do
    raise "No support for literal #{klass}"
  end
  handler.construct(object)
end

.construct(*args) ⇒ Node::Literal

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Construct object

Returns:



42
43
44
# File 'lib/aql/node/literal.rb', line 42

def self.construct(*args)
  new(*args)
end