lib/shelly/base.rb in shelly-0.0.6 vs lib/shelly/base.rb in shelly-0.0.7

- old
+ new

@@ -1,13 +1,27 @@ +require "yaml" + module Shelly class Base def current_user @user = User.new @user.load_credentials @user end + def config + @config ||= if File.exists?(config_file_path) + YAML::load(File.read(config_file_path)) + else + {} + end + end + + def config_file_path + File.join(current_user.config_dir, "config.yml") + end + def shelly - @shelly ||= Client.new(current_user.email, current_user.password) + @shelly ||= Client.new(current_user.email, current_user.password, config) end end end