Class: Bora::Event
- Inherits:
-
Object
show all
- Defined in:
- lib/bora/event.rb
Instance Method Summary
collapse
Constructor Details
#initialize(event) ⇒ Event
Returns a new instance of Event.
5
6
7
|
# File 'lib/bora/event.rb', line 5
def initialize(event)
@event = event
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
9
10
11
|
# File 'lib/bora/event.rb', line 9
def method_missing(sym, *args, &block)
@event.send(sym, *args, &block)
end
|
Instance Method Details
#status_complete? ⇒ Boolean
21
22
23
|
# File 'lib/bora/event.rb', line 21
def status_complete?
status_success? || status_failure?
end
|
#status_failure? ⇒ Boolean
17
18
19
|
# File 'lib/bora/event.rb', line 17
def status_failure?
@event.resource_status.end_with?("_FAILED")
end
|
#status_success? ⇒ Boolean
13
14
15
|
# File 'lib/bora/event.rb', line 13
def status_success?
@event.resource_status.end_with?("_COMPLETE")
end
|
#to_s(colorize = true) ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/bora/event.rb', line 25
def to_s(colorize = true)
color = case
when status_success?; :green
when status_failure?; :red
else; :yellow;
end
status = colorize ? @event.resource_status.colorize(color) : @event.resource_status
status_reason = @event.resource_status_reason ? " - #{@event.resource_status_reason}" : ""
"#{@event.timestamp} - #{@event.resource_type} - #{@event.logical_resource_id} - #{status}#{status_reason}"
end
|