Module: Configliere::Prompt

Defined in:
lib/configliere/prompt.rb

Overview

Method to prompt for

Instance Method Summary collapse

Instance Method Details

#prompt_for(attr, hint = nil) ⇒ Object

Retrieve the given param, or prompt for it



20
21
22
23
24
25
# File 'lib/configliere/prompt.rb', line 20

def prompt_for attr, hint=nil
  return self[attr] if has_key?(attr)
  hint ||= definition_of(attr, :description)
  hint   = " (#{hint})" if hint
  self[attr] = ask("#{attr}#{hint}? ")
end