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.
44 45 46 47 48 49 |
# File 'lib/convection/model/event.rb', line 44 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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/convection/model/event.rb', line 27 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
51 52 53 |
# File 'lib/convection/model/event.rb', line 51 def [](attr) @attributes[attr] end |
#[]=(attr, value) ⇒ Object
55 56 57 |
# File 'lib/convection/model/event.rb', line 55 def []=(attr, value) @attributes[attr] = value end |
#to_thor ⇒ Object
59 60 61 |
# File 'lib/convection/model/event.rb', line 59 def to_thor [name.downcase, , color] end |