Class: RakeTasks::Prompt
- Inherits:
-
Object
- Object
- RakeTasks::Prompt
- Defined in:
- lib/rake_tasks/release.rb
Instance Method Summary collapse
- #get_value ⇒ Object
-
#initialize(prompt, default = nil) ⇒ Prompt
constructor
A new instance of Prompt.
Constructor Details
#initialize(prompt, default = nil) ⇒ Prompt
Returns a new instance of Prompt.
6 7 8 9 |
# File 'lib/rake_tasks/release.rb', line 6 def initialize(prompt, default = nil) @prompt = prompt @default = default end |
Instance Method Details
#get_value ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rake_tasks/release.rb', line 11 def get_value value = nil value = STDIN.cooked { value = Readline::readline(label, false).chomp } value = @default if value == '' && @default value end |