Class: Autoweb::UI::Input

Inherits:
String
  • Object
show all
Includes:
Autoweb::UI
Defined in:
lib/autoweb/ui.rb

Instance Method Summary collapse

Methods included from Autoweb::UI

#ask, #ask_loop, #confirm, #display, #display2, #error, #format_date, #shell

Instance Method Details

#is?(str) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/autoweb/ui.rb', line 24

def is?(str)
  return if str.nil?
  self.downcase.strip == str.downcase.strip
end

#process_default(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/autoweb/ui.rb', line 8

def process_default(options={})
  if is?("q")
    exit(0)
  elsif is?("h")||is?("?")
    display options[:help]||"no help"
    raise RetryError
  else
    raise RetryError
  end
end

#yes?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/autoweb/ui.rb', line 20

def yes?
  self.is?("y")
end