Sha256: 60a7afa0815a53465b97aaed405ccfa84fe1daa6e606fb792410f0657dd9cfa1

Contents?: true

Size: 688 Bytes

Versions: 5

Compression:

Stored size: 688 Bytes

Contents

require 'colorize'

class Bora
  module Cfn
    class ChangeSetAction
      def initialize(action, replacement)
        @action = action
        @replacement = replacement
      end

      def to_s
        action_str = @action
        if @action == 'Modify'
          action_str =
            case @replacement
            when 'True' then 'Replace'
            when 'Conditional' then 'Replace (conditional)'
            else action_str
            end
        end
        action_str.colorize(color)
      end

      private

      def color
        case @action
        when 'Add' then :green
        when 'Remove' then :red
        else :yellow
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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