Class: Atomy::Grammar::AST::Quote

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) ⇒ Quote

Returns a new instance of Quote.



137
138
139
# File 'lib/atomy/grammar.rb', line 137

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



140
141
142
# File 'lib/atomy/grammar.rb', line 140

def node
  @node
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/atomy/node/equality.rb', line 26

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

#construct(gen) ⇒ Object



48
49
50
51
52
# File 'lib/atomy/node/constructable.rb', line 48

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

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

Yields:



75
76
77
# File 'lib/atomy/node/meta.rb', line 75

def each_child
  yield :node, @node
end

#throughObject



79
80
81
# File 'lib/atomy/node/meta.rb', line 79

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

#to_sObject



23
24
25
# File 'lib/atomy/node/pretty.rb', line 23

def to_s
  "'#@node"
end