lib/pingfm/config.rb in pingfm-2.0.0 vs lib/pingfm/config.rb in pingfm-2.1.0

- old
+ new

@@ -8,17 +8,21 @@ class << self # Prompts the user for their API key and saves it. def ask_for_app_key! STDOUT.print 'Enter your Ping.fm User API key (http://ping.fm/key/): ' - @@config ||= {} - @@config['app_key'] = STDIN.gets.chomp - save! + STDIN.gets.chomp end def [](key) setup! unless defined?(@@config) @@config[key] + end + + def []=(key, value) + @@config ||= {} + @@config[key] = value + save! end def save! ::File.open(CONFIG_FILE, 'w') do |config_file| ::YAML.dump(@@config, config_file)