class CfnFlow::EventPresenter

Attributes

event[RW]

Instance methods

Public Class Methods

header() click to toggle source
# File lib/cfn_flow/event_presenter.rb, line 18
def self.header
  %w(status logical_resource_id resource_type reason) * "\t"
end
new(event) click to toggle source
# File lib/cfn_flow/event_presenter.rb, line 25
def initialize(event)
  @event = event
  self.class.seen_event_ids << event.id
end
present(raw_events) { |new(e)| ... } click to toggle source

Yields each new event present to block

# File lib/cfn_flow/event_presenter.rb, line 12
def self.present(raw_events, &block)
  raw_events.to_a.reverse.sort_by(&:timestamp).
    reject {|e| seen_event_ids.include?(e.id) }.
    map    {|e| yield new(e) }
end
seen_event_ids() click to toggle source

Class methods

# File lib/cfn_flow/event_presenter.rb, line 7
def self.seen_event_ids
  @seen_event_ids ||= Set.new
end

Public Instance Methods

to_s() click to toggle source
# File lib/cfn_flow/event_presenter.rb, line 30
def to_s
    [
      event.resource_status,
      event.logical_resource_id,
      event.resource_type,
      event.resource_status_reason
    ].compact * "\t"
end