Module: Kryten::Config
- Defined in:
- lib/kryten/config.rb
Instance Method Summary collapse
Instance Method Details
#base_path ⇒ Object
7 8 9 |
# File 'lib/kryten/config.rb', line 7 def base_path File.(File.join(ENV['BUNDLE_GEMFILE'], '..')) end |
#config(entry = nil) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/kryten/config.rb', line 22 def config entry=nil @config ||= configure if entry @config.fetch(entry) else @config end end |
#configure ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kryten/config.rb', line 11 def configure classname = self.name.split('::') classname = if classname.one? classname.first.downcase else classname.collect(&:downcase).join('-') end file = File.open(File.join(self.base_path, "config/#{classname}.yml")) YAML.load(file)[classname] end |