class Sith::BaseMacro

Public Instance Methods

expand_macro(nodes) click to toggle source
# File lib/sith/macro.rb, line 21
def expand_macro(nodes)
  a = expand_to_source(nodes)

  Parser::CurrentRuby.parse a
end
represent(node) click to toggle source
# File lib/sith/macro.rb, line 5
def represent(node)
  return node.to_s unless node.is_a?(Parser::AST::Node) || node.is_a?(Array)

  if node.is_a?(Array)
    "#{node.map(&method(:represent)).join(', ')}"
  elsif node.type == :int
    node.children[0].to_s
  elsif node.type == :string
    node.children[0]
  elsif :send
    node.children[1].to_s
  else
    '?'
  end
end