Class: StackMaster::StackEvents::Presenter
- Inherits:
-
Object
- Object
- StackMaster::StackEvents::Presenter
- Defined in:
- lib/stack_master/stack_events/presenter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #event_colour(event) ⇒ Object
-
#initialize(io) ⇒ Presenter
constructor
A new instance of Presenter.
- #print_event(event) ⇒ Object
Constructor Details
#initialize(io) ⇒ Presenter
Returns a new instance of Presenter.
8 9 10 |
# File 'lib/stack_master/stack_events/presenter.rb', line 8 def initialize(io) @io = io end |
Class Method Details
.print_event(io, event) ⇒ Object
4 5 6 |
# File 'lib/stack_master/stack_events/presenter.rb', line 4 def self.print_event(io, event) new(io).print_event(event) end |
Instance Method Details
#event_colour(event) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/stack_master/stack_events/presenter.rb', line 16 def event_colour(event) if StackStates.failure_state?(event.resource_status) :red elsif StackStates.success_state?(event.resource_status) :green else :yellow end end |
#print_event(event) ⇒ Object
12 13 14 |
# File 'lib/stack_master/stack_events/presenter.rb', line 12 def print_event(event) @io.puts Rainbow("#{event..localtime} #{event.logical_resource_id} #{event.resource_type} #{event.resource_status} #{event.resource_status_reason}").color(event_colour(event)) end |