Class: AmpelExtase::BuildState
- Inherits:
-
Object
- Object
- AmpelExtase::BuildState
- Defined in:
- lib/ampel_extase/build_state.rb
Instance Attribute Summary collapse
-
#last_result ⇒ Object
readonly
Returns the value of attribute last_result.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #building? ⇒ Boolean
-
#initialize(last_result, is_building) ⇒ BuildState
constructor
A new instance of BuildState.
- #success? ⇒ Boolean
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(last_result, is_building) ⇒ BuildState
Returns a new instance of BuildState.
7 8 9 |
# File 'lib/ampel_extase/build_state.rb', line 7 def initialize(last_result, is_building) @last_result, @is_building = last_result, is_building end |
Instance Attribute Details
#last_result ⇒ Object (readonly)
Returns the value of attribute last_result.
11 12 13 |
# File 'lib/ampel_extase/build_state.rb', line 11 def last_result @last_result end |
Class Method Details
.for(a = nil) ⇒ Object
2 3 4 5 |
# File 'lib/ampel_extase/build_state.rb', line 2 def self.for(a = nil) a ||= [ "N/A", nil ] new(*a) end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 |
# File 'lib/ampel_extase/build_state.rb', line 25 def ==(other) to_a == other.to_a end |
#building? ⇒ Boolean
13 14 15 |
# File 'lib/ampel_extase/build_state.rb', line 13 def building? !!@is_building end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/ampel_extase/build_state.rb', line 17 def success? %w[SUCCESS N/A].include? @last_result end |
#to_a ⇒ Object
21 22 23 |
# File 'lib/ampel_extase/build_state.rb', line 21 def to_a return @last_result, @is_building end |
#to_s ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/ampel_extase/build_state.rb', line 29 def to_s if building? "#{@last_result} (building)" else @last_result.to_s end end |