Class: EacCli::RunnerWith::Confirmation::InputResult

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_cli/runner_with/confirmation/input_result.rb

Constant Summary collapse

INPUT_NO_FOR_ONE =
'n'
INPUT_NO_FOR_ALL =
'N'
INPUT_YES_FOR_ONE =
'y'
INPUT_YES_FOR_ALL =
'Y'
INPUT_FOR_ONE =
[INPUT_NO_FOR_ONE, INPUT_YES_FOR_ONE].freeze
INPUT_FOR_ALL =
[INPUT_NO_FOR_ALL, INPUT_YES_FOR_ALL].freeze
INPUT_NO =
[INPUT_NO_FOR_ONE, INPUT_NO_FOR_ALL].freeze
INPUT_YES =
[INPUT_YES_FOR_ONE, INPUT_YES_FOR_ALL].freeze
INPUT_LIST =
[INPUT_NO_FOR_ALL, INPUT_NO_FOR_ONE, INPUT_YES_FOR_ONE, INPUT_YES_FOR_ALL]
.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.by_message(message) ⇒ EacCli::RunnerWith::Confirmation::InputResult

Parameters:

  • message (String)

Returns:



25
26
27
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 25

def by_message(message)
  new(input_value_by_speaker(message))
end

.input_value_by_speaker(message) ⇒ String

Parameters:

  • message (String)

Returns:

  • (String)


31
32
33
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 31

def input_value_by_speaker(message)
  input(message, list: INPUT_LIST, ignore_case: false)
end

Instance Method Details

#confirm?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 39

def confirm?
  input_value_to_bool(INPUT_NO, INPUT_YES)
end

#for_all?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 44

def for_all?
  input_value_to_bool(INPUT_FOR_ONE, INPUT_FOR_ALL)
end