class Tempo::Views::Reporter

Attributes

view_records[RW]

Public Class Methods

add_format(*formats) click to toggle source
# File lib/tempo/views/reporter.rb, line 36
def add_format(*formats)
  @@formats ||= []
  formats.each {|format| @@formats << format}
end
add_options(options) click to toggle source
# File lib/tempo/views/reporter.rb, line 55
def add_options(options)
  @@options ||= {}
  @@options.merge! options
end
add_view_record(record) click to toggle source
# File lib/tempo/views/reporter.rb, line 60
def add_view_record(record)
  @@view_records ||= []

  if /Views::ViewRecords/.match record.class.name
    @@view_records << record

    # console must be able to return a value
    return console.report record
  else
    raise InvalidViewRecordError
  end
end
console() click to toggle source

All records are sent directly to the console, so it can decide if action is required immediately based on the type of record

# File lib/tempo/views/reporter.rb, line 51
def console
  @@console ||= Formatters::Interactive.new(options)
end
formats() click to toggle source
# File lib/tempo/views/reporter.rb, line 41
def formats
  @@formats ||= []
end
options() click to toggle source
# File lib/tempo/views/reporter.rb, line 45
def options
  @@options ||= {}
end
report() click to toggle source
# File lib/tempo/views/reporter.rb, line 77
def report
  # TODO send records to added formatters
  screen_formatter = Formatters::Screen.new(options)
  screen_formatter.format_records view_records
end