class RShade::Formatter::String

Constants

ROOT_SEP

Attributes

event_store[R]

Public Class Methods

new(event_store) click to toggle source
# File lib/rshade/formatter/string.rb, line 7
def initialize(event_store)
  @event_store = event_store
end

Public Instance Methods

call() click to toggle source
# File lib/rshade/formatter/string.rb, line 11
def call
  buffer = StringIO.new
  event_store.iterate do |node, depth|
    if depth == 1
      buffer << ROOT_SEP
      next
    end
    puts line(node, depth)
  end
  buffer.string
end
line(value, depth) click to toggle source
# File lib/rshade/formatter/string.rb, line 23
def line(value, depth)
  class_method = "#{value.klass}##{value.method_name}".colorize(:green)
  full_path = "#{value.path}:#{value.lineno}".colorize(:blue)
  "#{'  ' * depth}#{class_method}(#{value.vars}) -> #{full_path}\n"
end