Sha256: a7317dbad06336c8d080b0d8ae3ceb430df54b067c5fc71fe81bd19bb4ff679e
Contents?: true
Size: 862 Bytes
Versions: 1
Compression:
Stored size: 862 Bytes
Contents
# encoding: UTF-8 module Mutaconf VERSION = '0.1.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] prefix = prefix.upcase if prefix and options[:upcase] != false 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 end end Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each{ |lib| require lib }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mutaconf-0.1.0 | lib/mutaconf.rb |