class Playwright::CLI::Utils::Ask::Ask
Constants
- DEFAULT_COLOR
- FALSE_RESPONSE
- TRUE_RESPONSE
Public Instance Methods
boolean_question(user_question)
click to toggle source
# File lib/playwright/cli/utils/ask.rb, line 20 def boolean_question user_question response = question "#{user_question} [yn]" map_boolean_response response end
question(user_question)
click to toggle source
# File lib/playwright/cli/utils/ask.rb, line 34 def question user_question display.print "#{user_question} ", color: DEFAULT_COLOR, method: :print $stdin.gets end
url_question(user_question)
click to toggle source
# File lib/playwright/cli/utils/ask.rb, line 25 def url_question user_question response = question user_question if response =~ URI::regexp response else display.error "Invalid URL!" end end
Private Instance Methods
map_boolean_response(value)
click to toggle source
# File lib/playwright/cli/utils/ask.rb, line 41 def map_boolean_response value { TRUE_RESPONSE => true, FALSE_RESPONSE => false }[sanitize_boolean_response value] end
sanitize_boolean_response(value)
click to toggle source
# File lib/playwright/cli/utils/ask.rb, line 45 def sanitize_boolean_response value value&.strip&.downcase&.to_sym end