class VisualizeRuby::AstHelper
Public Class Methods
new(ast)
click to toggle source
# File lib/visualize_ruby/ast_helper.rb, line 3 def initialize(ast) @ast = ast end
Public Instance Methods
description()
click to toggle source
# File lib/visualize_ruby/ast_helper.rb, line 7 def description return @ast unless @ast.respond_to?(:type) Unparser.unparse(@ast) end
first_line()
click to toggle source
# File lib/visualize_ruby/ast_helper.rb, line 16 def first_line return unless @ast @ast.location.first_line end
id(description: self.description)
click to toggle source
# File lib/visualize_ruby/ast_helper.rb, line 12 def id(description: self.description) description.to_s + " L#{[@ast.location.first_line, @ast.location.last_line].compact.uniq.join("-")}" end