In Files

  • pp.rb

Parent

Class/Module Index [+]

Quicksearch

RubyVM::AbstractSyntaxTree::Node

Public Instance Methods

pretty_print(q) click to toggle source
 
               # File pp.rb, line 531
def pretty_print(q)
  q.group(1, "(#{type}@#{first_lineno}:#{first_column}-#{last_lineno}:#{last_column}", ")") {
    case type
    when :SCOPE
      pretty_print_children(q, %w"tbl args body")
    when :ARGS
      pretty_print_children(q, %w[pre_num pre_init opt first_post post_num post_init rest kw kwrest block])
    when :DEFN
      pretty_print_children(q, %w[mid body])
    else
      pretty_print_children(q)
    end
  }
end
            
pretty_print_children(q, names = []) click to toggle source
 
               # File pp.rb, line 518
def pretty_print_children(q, names = [])
  children.zip(names) do |c, n|
    if n
      q.breakable
      q.text "#{n}:"
    end
    q.group(2) do
      q.breakable
      q.pp c
    end
  end
end