Class: Atomy::Grammar::AST::Unquote

Inherits:
Node show all
Defined in:
lib/atomy/grammar.rb,
lib/atomy/node/meta.rb,
lib/atomy/node/pretty.rb,
lib/atomy/node/equality.rb,
lib/atomy/node/constructable.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#accept, #attributes, basename, #children, #each_attribute

Constructor Details

#initialize(node) ⇒ Unquote

Returns a new instance of Unquote.



155
156
157
# File 'lib/atomy/grammar.rb', line 155

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



158
159
160
# File 'lib/atomy/grammar.rb', line 158

def node
  @node
end

Instance Method Details

#==(other) ⇒ Object



38
39
40
# File 'lib/atomy/node/equality.rb', line 38

def ==(other)
  super || other.is_a?(self.class) && @node == other.node
end

#construct(gen) ⇒ Object



64
65
66
67
68
# File 'lib/atomy/node/constructable.rb', line 64

def construct(gen)
  push_node(gen, :Unquote)
  @node.construct(gen)
  gen.send(:new, 1)
end

#each_child {|:node, @node| ... } ⇒ Object

Yields:



95
96
97
# File 'lib/atomy/node/meta.rb', line 95

def each_child
  yield :node, @node
end

#throughObject



99
100
101
# File 'lib/atomy/node/meta.rb', line 99

def through
  self.class.new(yield @node)
end

#to_sObject



35
36
37
# File 'lib/atomy/node/pretty.rb', line 35

def to_s
  "~#@node"
end