vendor/bundle/ruby/1.8/gems/io-reactor-1.0.4/rake/helpers.rb
### Output the specified <tt>prompt_string</tt> as a prompt (in green) and
### return the user's input with leading and trailing spaces removed.  If a
### test is provided, the prompt will repeat until the test returns true.
### An optional failure message can also be passed in.
Output the specified prompt_string as a prompt (in green) and
return the user's input with leading and trailing spaces removed.  If a
test is provided, the prompt will repeat until the test returns true.
An optional failure message can also be passed in.
Output the specified prompt_string as a prompt ( in green ) and return the user ' s input with leading and trailing spaces removed . If a test is provided the prompt will repeat until the test returns true . An optional failure message can also be passed in .
def prompt( prompt_string, failure_msg="Try again." ) 
	prompt_string.chomp!
	prompt_string << ":" unless /\W$/.match( prompt_string )
	response = nil
	begin
		prompt = make_prompt_string( prompt_string )
		response = Readline.readline( prompt ) || ''
		response.strip!
		if block_given? && ! yield( response ) 
			error_message( failure_msg + "\n\n" )
			response = nil
		end
	end while response.nil?
	return response
end
def prompt ( prompt_string , failure_msg = "Try again." ) prompt_string . chomp! prompt_string << ":" unless / \W $ / . match ( prompt_string ) response = nil begin prompt = make_prompt_string ( prompt_string ) response = Readline . readline ( prompt ) || '' response . strip! if block_given? && ! yield ( response ) error_message ( failure_msg + "\n\n" ) response = nil end end while response . nil? return response end
Output the specified <tt>prompt_string</tt> as a prompt (in green) and
return the user's input with leading and trailing spaces removed.
Output the specified <tt > prompt_string< / tt > as a prompt ( in green ) and return the user ' s input with leading and trailing spaces removed .
# :yields: response
prompt_string
failure_msg