Class: Bosh::Cli::Resurrection
Instance Method Summary collapse
- #disabled? ⇒ Boolean
- #enabled? ⇒ Boolean
-
#initialize(state) ⇒ Resurrection
constructor
A new instance of Resurrection.
- #paused? ⇒ Boolean
- #validate_state! ⇒ Object
Constructor Details
#initialize(state) ⇒ Resurrection
Returns a new instance of Resurrection.
3 4 5 6 7 |
# File 'lib/cli/resurrection.rb', line 3 def initialize(state) @state = state validate_state! end |
Instance Method Details
#disabled? ⇒ Boolean
17 18 19 |
# File 'lib/cli/resurrection.rb', line 17 def disabled? %w[false no off disable].include?(state) end |
#enabled? ⇒ Boolean
13 14 15 |
# File 'lib/cli/resurrection.rb', line 13 def enabled? %w[true yes on enable].include?(state) end |
#paused? ⇒ Boolean
9 10 11 |
# File 'lib/cli/resurrection.rb', line 9 def paused? !enabled? end |
#validate_state! ⇒ Object
21 22 23 24 25 |
# File 'lib/cli/resurrection.rb', line 21 def validate_state! unless enabled? || disabled? err("Resurrection paused state should be on/off, true/false, yes/no or enable/disable received #{state.inspect}") end end |