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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



31
32
33
# File 'lib/tempo/views/view_records/base.rb', line 31

def category
  @category
end

#messageObject

Returns the value of attribute message.



31
32
33
# File 'lib/tempo/views/view_records/base.rb', line 31

def message
  @message
end

#typeObject

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