Class: Tempo::Views::ViewRecords::Message
- Inherits:
-
Object
- Object
- Tempo::Views::ViewRecords::Message
- Defined in:
- lib/tempo/views/view_records/base.rb
Overview
The most simple view records, with a message string and a category, which defaults to :info. Categories can be used for color / logging diferentiation. category :error will raise an error after all viewRecords have been run through the reporters
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#message ⇒ Object
Returns the value of attribute message.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #format(&block) ⇒ Object
-
#initialize(message, options = {}) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(message, options = {}) ⇒ Message
Returns a new instance of Message.
33 34 35 36 37 38 |
# File 'lib/tempo/views/view_records/base.rb', line 33 def initialize(, ={}) = @category = .fetch( :category, :info ) @type = "message" Reporter.add_view_record self end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
31 32 33 |
# File 'lib/tempo/views/view_records/base.rb', line 31 def category @category end |
#message ⇒ Object
Returns the value of attribute message.
31 32 33 |
# File 'lib/tempo/views/view_records/base.rb', line 31 def end |
#type ⇒ Object
Returns the value of attribute type.
31 32 33 |
# File 'lib/tempo/views/view_records/base.rb', line 31 def type @type end |
Instance Method Details
#format(&block) ⇒ Object
40 41 42 43 |
# File 'lib/tempo/views/view_records/base.rb', line 40 def format(&block) block ||= lambda {|m| "#{m.message}"} block.call self end |