Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Commit

Permalink
Lose the accessors, replace with dynamic method
Browse files Browse the repository at this point in the history
  • Loading branch information
simpsonjulian committed May 17, 2012
1 parent 16accb2 commit 9eea962
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/config.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require 'singleton'
require 'skewer'

module Skewer
# responsible for all configuration, once I move all the options in
class SkewerConfig
include Singleton
include Skewer
attr_accessor :aws_service, :puppet_repo, :region, :flavor_id, :aws_username, :flavor_id

def initialize
reset
Expand Down Expand Up @@ -71,5 +71,9 @@ def slurp_options(options)
self.set(self.translate_key(key), value) unless value.nil?
end
end

def method_missing(sym, *args, &block)
get(sym)
end
end
end
6 changes: 6 additions & 0 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@
config.slurp_options({:puppetcode => '../foo'})
config.get(:puppet_repo).should == '../foo'
end

it "should return an option if you don't have an accessor" do
config = Skewer::SkewerConfig.instance
config.set('pint', 'Doom Bar')
config.pint.should == 'Doom Bar'
end
end

0 comments on commit 9eea962

Please sign in to comment.