Top Level Namespace
Defined Under Namespace
Modules: Comet
Instance Method Summary collapse
- #difficulty_to_string(difficult_rating) ⇒ Object
- #prompt_for_setting(name, existing_settings) ⇒ Object
Instance Method Details
#difficulty_to_string(difficult_rating) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/helpers.rb', line 17 def difficulty_to_string() case when 1 "\e[32measy\e[0m" when 2 "\e[33mintermediate\e[0m" when 3 "\e[31mhard\e[0m" else "" end end |
#prompt_for_setting(name, existing_settings) ⇒ Object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/helpers.rb', line 1 def prompt_for_setting(name, existing_settings) if existing_settings.has_key?(name) print "#{name.capitalize} (#{existing_settings[name]}): " else print "#{name.capitalize}: " end input = gets.chomp.strip if !input.empty? input else existing_settings[name] end end |