class Glyph::SyntaxNode
A subclass of Glyph::SyntaxNode
is instantiated by Glyph::Parser
whenever a known text element is parsed. @since 0.3.0
Public Instance Methods
evaluate(context, options={})
click to toggle source
@return [String] the value of the :value key @since 0.3.0
# File lib/glyph/syntax_node.rb, line 30 def evaluate(context, options={}) self[:value] end
inspect()
click to toggle source
@return [String] a textual representation of self @since 0.4.0
# File lib/glyph/syntax_node.rb, line 18 def inspect string = "" descend do |e, level| # Remove document key to avoid endless resursion hash = e.to_hash.reject{|k,v| k == :document} string << " "*level+"(#{e.class})"+hash.inspect+"\n" end string.chomp end
parent_macro()
click to toggle source
@return [Glyph::MacroNode] the first Glyph::MacroNode
ancestor @since 0.3.0
# File lib/glyph/syntax_node.rb, line 36 def parent_macro find_parent{|n| n.is_a?(MacroNode)} end
to_s()
click to toggle source
@return [String] an empty string @since 0.3.0
# File lib/glyph/syntax_node.rb, line 12 def to_s "" end