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.
4 5 6 7 |
# File 'lib/rake_tasks/release.rb', line 4 def initialize(prompt, default = nil) @prompt = prompt @default = default end |
Instance Method Details
#get_value ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rake_tasks/release.rb', line 9 def get_value value = nil value = STDIN.cooked { value = Readline::readline(label, false).chomp } value = @default if value == '' && @default value end |