Class: Tempo::Views::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/tempo/views/reporter.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.view_recordsObject

Returns the value of attribute view_records.



28
29
30
# File 'lib/tempo/views/reporter.rb', line 28

def view_records
  @view_records
end

Class Method Details

.add_format(*formats) ⇒ Object



30
31
32
33
# File 'lib/tempo/views/reporter.rb', line 30

def add_format(*formats)
  @@formats ||= []
  formats.each {|format| @@formats << format}
end

.add_options(options) ⇒ Object



43
44
45
46
# File 'lib/tempo/views/reporter.rb', line 43

def add_options(options)
  @@options ||= {}
  @@options.merge! options
end

.add_view_record(record) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/tempo/views/reporter.rb', line 48

def add_view_record(record)
  @@view_records ||= []

  if /Views::ViewRecords/.match record.class.name
    @@view_records << record
  else
    raise InvalidViewRecordError
  end
end

.formatsObject



35
36
37
# File 'lib/tempo/views/reporter.rb', line 35

def formats
  @@formats ||= []
end

.optionsObject



39
40
41
# File 'lib/tempo/views/reporter.rb', line 39

def options
  @@options ||= {}
end

.reportObject



62
63
64
65
66
# File 'lib/tempo/views/reporter.rb', line 62

def report
  # TODO send records to added formatters
  screen_formatter = Formatters::Screen.new
  screen_formatter.format_records view_records, options
end