Class: PlutoniumGenerators::NonInteractivePrompt

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/pu/lib/plutonium_generators/non_interactive_prompt.rb

Overview

A drop-in replacement for TTY::Prompt that raises on any interactive method. Used when –no-interactive is passed or when there’s no TTY (e.g., tests, CI).

Instance Method Summary collapse

Instance Method Details

#ask(question) ⇒ Object

Raises:

  • (Thor::Error)


11
12
13
# File 'lib/generators/pu/lib/plutonium_generators/non_interactive_prompt.rb', line 11

def ask(question, **)
  raise Thor::Error, "Interactive prompt not available: #{question}. Provide the required option explicitly."
end

#multi_select(question) ⇒ Object

Raises:

  • (Thor::Error)


23
24
25
# File 'lib/generators/pu/lib/plutonium_generators/non_interactive_prompt.rb', line 23

def multi_select(question, **)
  raise Thor::Error, "Interactive prompt not available: #{question}. Provide the required option explicitly."
end

#no?(question) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (Thor::Error)


19
20
21
# File 'lib/generators/pu/lib/plutonium_generators/non_interactive_prompt.rb', line 19

def no?(question, **)
  raise Thor::Error, "Interactive prompt not available: #{question}. Provide the required option explicitly."
end

#select(question, choices = nil) ⇒ Object

Raises:

  • (Thor::Error)


7
8
9
# File 'lib/generators/pu/lib/plutonium_generators/non_interactive_prompt.rb', line 7

def select(question, choices = nil, **)
  raise Thor::Error, "Interactive prompt not available: #{question}. Provide the required option explicitly."
end

#yes?(question) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (Thor::Error)


15
16
17
# File 'lib/generators/pu/lib/plutonium_generators/non_interactive_prompt.rb', line 15

def yes?(question, **)
  raise Thor::Error, "Interactive prompt not available: #{question}. Provide the required option explicitly."
end