Sha256: b78750e94d88505e4204a3174f846e9e8e2e284d2f7b3d6c3097be0297e555b5

Contents?: true

Size: 611 Bytes

Versions: 10

Compression:

Stored size: 611 Bytes

Contents

require 'colorize'

module Bora
  class Status
    def initialize(status)
      @status = status
    end

    def success?
      @status.end_with?("_COMPLETE") && !@status.include?("ROLLBACK")
    end

    def failure?
      @status.end_with?("_FAILED") || @status.include?("ROLLBACK")
    end

    def deleted?
      @status == "DELETE_COMPLETE"
    end

    def complete?
      success? || failure?
    end

    def to_s
      @status.colorize(color)
    end


    private

    def color
      case
        when success?; :green
        when failure?; :red
        else; :yellow;
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bora-0.9.4 lib/bora/status.rb
bora-0.9.3 lib/bora/status.rb
bora-0.9.2 lib/bora/status.rb
bora-0.9.1 lib/bora/status.rb
bora-0.9.0 lib/bora/status.rb
bora-0.8.0 lib/bora/status.rb
bora-0.7.0 lib/bora/status.rb
bora-0.6.0 lib/bora/status.rb
bora-0.5.1 lib/bora/status.rb
bora-0.5.0 lib/bora/status.rb