lib/mutaconf.rb in mutaconf-0.1.1 vs lib/mutaconf.rb in mutaconf-0.2.0
- old
+ new
@@ -1,14 +1,10 @@
# encoding: UTF-8
module Mutaconf
- VERSION = '0.1.1'
+ VERSION = '0.2.0'
- def self.dsl *args
- DSL.new *args
- end
-
def self.env *args
options = args.last.kind_of?(Hash) ? args.pop : {}
args.flatten.inject({}) do |memo,key|
env_key = options[:upcase] == false ? key.to_s : key.to_s.upcase
prefix = options[:prefix]
@@ -16,19 +12,15 @@
memo[key.to_sym] = ENV["#{prefix}#{env_key}"]
memo
end
end
- def self.extract source, key
- if source.kind_of? Hash
- source[key.to_sym]
- elsif source.kind_of? OpenStruct
- source.send key.to_sym
- elsif source.kind_of?(String) or source.kind_of?(Symbol)
- source
- elsif source
- source.send key.to_sym
- end
+ def self.config *args, &block
+ Config.find *args, &block
+ end
+
+ def self.config_file *args, &block
+ Config.find_file *args, &block
end
end
Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each{ |lib| require lib }