vendor/bundle/ruby/1.8/gems/Ruby-MemCache-0.0.1/utils.rb
### Prompt the user with the given <tt>promptString</tt> via #prompt,
### substituting the given <tt>default</tt> if the user doesn't input
### anything.  If a test is provided, the prompt will repeat until the test
### returns true.  An optional failure message can also be passed in.
Prompt the user with the given promptString via #prompt,
substituting the given default if the user doesn't input
anything.  If a test is provided, the prompt will repeat until the test
returns true.  An optional failure message can also be passed in.
Prompt the user with the given promptString via #prompt substituting the given default if the user doesn ' t input anything . If a test is provided the prompt will repeat until the test returns true . An optional failure message can also be passed in .
def promptWithDefault( promptString, default, failure_msg="Try again." )
		response = nil
		begin
			response = prompt( "%s [%s]" % [ promptString, default ] )
			response = default if response.empty?
			if block_given? && ! yield( response ) 
				errorMessage( failure_msg + "\n\n" )
				response = nil
			end
		end until response
		return response
	end
def promptWithDefault ( promptString , default , failure_msg = "Try again." ) response = nil begin response = prompt ( "%s [%s]" % [ promptString , default ] ) response = default if response . empty? if block_given? && ! yield ( response ) errorMessage ( failure_msg + "\n\n" ) response = nil end end until response return response end
Prompt the user with the given <tt>promptString</tt> via #prompt,
substituting the given <tt>default</tt> if the user doesn't input
anything.
Prompt the user with the given <tt > promptString< / tt > via #prompt substituting the given <tt > default< / tt > if the user doesn ' t input anything .
promptString
default
failure_msg