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
Containers send :pospone => true in options in order to manage triggering the message themselves
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.
36 37 38 39 40 41 |
# File 'lib/tempo/views/view_records/base.rb', line 36 def initialize(, ={}) @message = @category = .fetch( :category, :info ) @type = "message" Reporter.add_view_record self unless [:postpone] end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
34 35 36 |
# File 'lib/tempo/views/view_records/base.rb', line 34 def category @category end |
#message ⇒ Object
Returns the value of attribute message.
34 35 36 |
# File 'lib/tempo/views/view_records/base.rb', line 34 def @message end |
#type ⇒ Object
Returns the value of attribute type.
34 35 36 |
# File 'lib/tempo/views/view_records/base.rb', line 34 def type @type end |
Instance Method Details
#format(&block) ⇒ Object
43 44 45 46 |
# File 'lib/tempo/views/view_records/base.rb', line 43 def format(&block) block ||= lambda {|m| "#{m.}"} block.call self end |