Class: Convection::Model::Event
- Inherits:
-
Object
- Object
- Convection::Model::Event
- Extended by:
- Mixin::Colorize
- Defined in:
- lib/convection/model/event.rb
Overview
Wrap events with some smarts
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#message ⇒ Object
Returns the value of attribute message.
-
#name ⇒ Object
Returns the value of attribute name.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
- #[](attr) ⇒ Object
- #[]=(attr, value) ⇒ Object
-
#initialize(name, message, level = :info, attributes = {}) ⇒ Event
constructor
A new instance of Event.
- #to_thor ⇒ Object
Methods included from Mixin::Colorize
Constructor Details
#initialize(name, message, level = :info, attributes = {}) ⇒ Event
Returns a new instance of Event
43 44 45 46 47 48 |
# File 'lib/convection/model/event.rb', line 43 def initialize(name, , level = :info, attributes = {}) @name = name @message = @level = level @attributes = attributes end |
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level
14 15 16 |
# File 'lib/convection/model/event.rb', line 14 def level @level end |
#message ⇒ Object
Returns the value of attribute message
13 14 15 |
# File 'lib/convection/model/event.rb', line 13 def @message end |
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/convection/model/event.rb', line 12 def name @name end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
15 16 17 |
# File 'lib/convection/model/event.rb', line 15 def @timestamp end |
Class Method Details
.from_cf(event) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/convection/model/event.rb', line 26 def from_cf(event) Event.new(event.resource_status.downcase, "#{ event.logical_resource_id }: (#{ event.resource_type }/"\ "#{ event.physical_resource_id}) #{ event.resource_status_reason }", event.resource_status, :event_id => event.event_id, :logical_resource_id => event.logical_resource_id, :physical_resource_id => event.physical_resource_id, :resource_properties => event.resource_properties, :resource_status_reason => event.resource_status_reason, :resource_type => event.resource_type, :stack_id => event.stack_id, :stack_name => event.stack_name, :timestamp => event.) end |
Instance Method Details
#[](attr) ⇒ Object
50 51 52 |
# File 'lib/convection/model/event.rb', line 50 def [](attr) @attributes[attr] end |
#[]=(attr, value) ⇒ Object
54 55 56 |
# File 'lib/convection/model/event.rb', line 54 def []=(attr, value) @attributes[attr] = value end |
#to_thor ⇒ Object
58 59 60 |
# File 'lib/convection/model/event.rb', line 58 def to_thor [name.downcase, , color] end |