Class: LocalConf
- Includes:
- Hash::Slop
- Defined in:
- lib/vex/base/local_conf.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ LocalConf
constructor
A new instance of LocalConf.
Methods included from Hash::Slop
Methods inherited from Hash
#delete_multi, #insp, #inspect, #slop!, #sloppy?
Methods included from Hash::EnsureKeys
Methods included from Hash::Extract
Methods included from Hash::Compact
Methods included from Hash::Extras
#delete_all, #hmap, included, #select_entries
Methods included from Hash::Cross
Constructor Details
#initialize(file) ⇒ LocalConf
Returns a new instance of LocalConf.
4 5 6 7 8 9 10 11 12 |
# File 'lib/vex/base/local_conf.rb', line 4 def initialize(file) r1 = load file.sub(/\.yml$/, ".defaults.yml") r2 = load file return if r1 || r2 raise Errno::ENOENT, "Missing configuration file #{App.root}/config/#{file.sub(/\.yml$/, "")}{.defaults}.yml}" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object (private)
33 34 35 36 37 38 |
# File 'lib/vex/base/local_conf.rb', line 33 def method_missing(sym, *args, &block) return super unless args.empty? && !block_given? && sym.to_s =~ /(.*)\?/ !fetch($1.to_sym).blank? rescue IndexError false end |