Class: Atomy::Grammar::AST::QuasiQuote

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

Returns a new instance of QuasiQuote.



131
132
133
# File 'lib/atomy/grammar.rb', line 131

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



134
135
136
# File 'lib/atomy/grammar.rb', line 134

def node
  @node
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/atomy/node/equality.rb', line 32

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

#construct(gen) ⇒ Object



56
57
58
59
60
# File 'lib/atomy/node/constructable.rb', line 56

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

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

Yields:



85
86
87
# File 'lib/atomy/node/meta.rb', line 85

def each_child
  yield :node, @node
end

#throughObject



89
90
91
# File 'lib/atomy/node/meta.rb', line 89

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

#to_sObject



29
30
31
# File 'lib/atomy/node/pretty.rb', line 29

def to_s
  "`#@node"
end