Class: Tempo::Views::Reporter
- Inherits:
-
Object
- Object
- Tempo::Views::Reporter
- Defined in:
- lib/tempo/views/reporter.rb
Class Attribute Summary collapse
-
.view_records ⇒ Object
Returns the value of attribute view_records.
Class Method Summary collapse
- .add_format(*formats) ⇒ Object
- .add_options(options) ⇒ Object
- .add_view_record(record) ⇒ Object
-
.console ⇒ Object
All records are sent directly to the console, so it can decide if action is required immediately based on the type of record.
- .formats ⇒ Object
- .options ⇒ Object
- .report ⇒ Object
Class Attribute Details
.view_records ⇒ Object
Returns the value of attribute view_records.
34 35 36 |
# File 'lib/tempo/views/reporter.rb', line 34 def view_records @view_records end |
Class Method Details
.add_format(*formats) ⇒ Object
36 37 38 39 |
# File 'lib/tempo/views/reporter.rb', line 36 def add_format(*formats) @@formats ||= [] formats.each {|format| @@formats << format} end |
.add_options(options) ⇒ Object
55 56 57 58 |
# File 'lib/tempo/views/reporter.rb', line 55 def () @@options ||= {} @@options.merge! end |
.add_view_record(record) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 |
# 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 ⇒ Object
All records are sent directly to the console, so it can decide if action is required immediately based on the type of record
51 52 53 |
# File 'lib/tempo/views/reporter.rb', line 51 def console @@console ||= Formatters::Interactive.new() end |
.formats ⇒ Object
41 42 43 |
# File 'lib/tempo/views/reporter.rb', line 41 def formats @@formats ||= [] end |
.options ⇒ Object
45 46 47 |
# File 'lib/tempo/views/reporter.rb', line 45 def @@options ||= {} end |
.report ⇒ Object
77 78 79 80 81 |
# File 'lib/tempo/views/reporter.rb', line 77 def report # TODO send records to added formatters screen_formatter = Formatters::Screen.new() screen_formatter.format_records view_records end |