Class: Bosh::Cli::Resurrection

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/resurrection.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/cli/resurrection.rb', line 17

def disabled?
  %w[false no off disable].include?(state)
end

#enabled?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/cli/resurrection.rb', line 13

def enabled?
  %w[true yes on enable].include?(state)
end

#paused?Boolean

Returns:

  • (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