Class: Bora::Cfn::ChangeSet
- Inherits:
-
Object
- Object
- Bora::Cfn::ChangeSet
- Defined in:
- lib/bora/cfn/change_set.rb
Instance Method Summary collapse
- #changes? ⇒ Boolean
-
#initialize(change_set, is_summary = false) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
- #status_complete? ⇒ Boolean
- #status_failure? ⇒ Boolean
- #status_success? ⇒ Boolean
- #to_s(changes_only: false) ⇒ Object
Constructor Details
#initialize(change_set, is_summary = false) ⇒ ChangeSet
Returns a new instance of ChangeSet.
7 8 9 10 11 12 13 |
# File 'lib/bora/cfn/change_set.rb', line 7 def initialize(change_set, is_summary = false) @change_set = change_set @is_summary = is_summary @status = Status.new(@change_set.status) @execution_status = Status.new(@change_set.execution_status) @changes = @is_summary ? [] : change_set.changes.map { |c| Change.new(c) } end |
Instance Method Details
#changes? ⇒ Boolean
27 28 29 |
# File 'lib/bora/cfn/change_set.rb', line 27 def changes? @status.success? && !@changes.empty? end |
#status_complete? ⇒ Boolean
23 24 25 |
# File 'lib/bora/cfn/change_set.rb', line 23 def status_complete? status_success? || status_failure? end |
#status_failure? ⇒ Boolean
19 20 21 |
# File 'lib/bora/cfn/change_set.rb', line 19 def status_failure? @status.failure? end |
#status_success? ⇒ Boolean
15 16 17 |
# File 'lib/bora/cfn/change_set.rb', line 15 def status_success? @status.success? end |
#to_s(changes_only: false) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bora/cfn/change_set.rb', line 31 def to_s(changes_only: false) reason = @change_set.status_reason ? " (#{@change_set.status_reason})" : '' description = @change_set.description ? " - #{@change_set.description}" : '' changes_str = !@is_summary ? @changes.map(&:to_s).join("\n") : '' if changes_only s = changes_str else s = "#{@change_set.change_set_name.bold} - #{@change_set.creation_time.getlocal} - #{@status}#{reason} - #{@execution_status}#{description}" s += "\n#{changes_str}" unless changes_str.empty? end s end |