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:



23
24
25
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 23

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

.input_value_by_speaker(message) ⇒ String

Parameters:

  • message (String)

Returns:

  • (String)


29
30
31
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 29

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

Instance Method Details

#confirm?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 37

def confirm?
  input_value_to_bool(INPUT_NO, INPUT_YES)
end

#for_all?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/eac_cli/runner_with/confirmation/input_result.rb', line 42

def for_all?
  input_value_to_bool(INPUT_FOR_ONE, INPUT_FOR_ALL)
end