Top Level Namespace

Defined Under Namespace

Modules: Kernel, Subversion Classes: Array, IO, Object, String

Instance Method Summary collapse

Instance Method Details

#confirm(question, options = ['Yes', 'No']) ⇒ Object



125
126
127
128
129
130
131
132
133
134
# File 'lib/svn-command/svn_command.rb', line 125

def confirm(question, options = ['Yes', 'No'])
  print question + " " +
    "Yes".menu_item(:red) + ", " +
    "No".menu_item(:green) + 
    " > "
  response = ''
  # Currently allow user to press Enter to accept the default.
  response = $stdin.getch.downcase while !['y', 'n', "\n"].include?(begin response.downcase!; response end)
  response
end