Class: Tempo::Views::ViewRecords::Message

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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, options={})
  @message = message
  @category = options.fetch( :category, :info )
  @type = "message"
  Reporter.add_view_record self unless options[:postpone]
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



34
35
36
# File 'lib/tempo/views/view_records/base.rb', line 34

def category
  @category
end

#messageObject

Returns the value of attribute message.



34
35
36
# File 'lib/tempo/views/view_records/base.rb', line 34

def message
  @message
end

#typeObject

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.message}"}
  block.call self
end