class Glyph::AttributeNode

A Glyph macro attribute in Glyph Abstract Syntax Tree @since 0.3.0

Public Instance Methods

contents() click to toggle source

@return [String] a textual representation of the attribute contents @since 0.3.0

# File lib/glyph/syntax_node.rb, line 219
def contents
        self[:escape] ? ".[=#{children.join}=]" : children.join
end
evaluate(context, options={:attrs => false}) click to toggle source

@param [Glyph::MacroNode] context the context of the macro @param [Hash] options a hash of options @option options [Boolean] :attrs whether to evaluate child nodes or not @return [String] the evaluated child nodes @since 0.3.0

# File lib/glyph/syntax_node.rb, line 228
def evaluate(context, options={:attrs => false})
        self[:value] = ""
        self.children.each {|c| self[:value] << c.evaluate(context) } if options[:attrs]
        self[:value]
end
to_s() click to toggle source

@return [String] a textual representation of the attribute node @since 0.3.0

# File lib/glyph/syntax_node.rb, line 212
def to_s
        e = self[:escape] ? "=" : ""
        "@#{self[:name]}["+e+children.join+e+"]"
end