Commits

Richo Healey committed eb2d483

Half assed attempt at refactoring access to config

Comments (0)

Files changed (2)

lib/twat/actions.rb

     end
 
     def account
-      @account ||= config[opts[:account]]
+      @account ||=
+        if opts.include?(:account)
+          config.accounts[opts[:account]]
+        else
+          config.default_account
+        end
     end
 
   end

lib/twat/config.rb

       config.delete(key)
     end
 
+    def accounts
+      return config[:accounts]
+    end
+
+    def default_account
+      return config[:accounts][config[:default]]
+    end
+
     def self.consumer_info
       {
         consumer_key: "jtI2q3Z4NIJAehBG4ntPIQ",