Sha256: 4dbe6f604f746fb8a01a97e36c7506ae52203d0fce9fda947f8aa8f3e6982b7d

Contents?: true

Size: 997 Bytes

Versions: 5

Compression:

Stored size: 997 Bytes

Contents

require 'bora/cfn/status'

class Bora
  module Cfn
    class Event
      def initialize(event)
        @event = event
        @status = Status.new(@event.resource_status)
      end

      def respond_to_missing?(method_name, include_private = false)
        return false if method_name == :to_ary
        super
      end

      def method_missing(method_name, *args, &block)
        if method_name.to_s =~ /(.*)/
          @event.send(Regexp.last_match[1], *args, &block)
        else
          super
        end
      end

      def status_success?
        @status.success?
      end

      def status_failure?
        @status.failure?
      end

      def status_complete?
        status_success? || status_failure?
      end

      def to_s
        status_reason = @event.resource_status_reason ? " - #{@event.resource_status_reason}" : ''
        "#{@event.timestamp.getlocal} - #{@event.resource_type} - #{@event.logical_resource_id} - #{@status}#{status_reason}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bora-1.7.4 lib/bora/cfn/event.rb
bora-1.7.3 lib/bora/cfn/event.rb
bora-1.7.2 lib/bora/cfn/event.rb
bora-1.7.1 lib/bora/cfn/event.rb
bora-1.7.0 lib/bora/cfn/event.rb