| Class | Config |
| In: |
lib/rs/config.rb
|
| Parent: | Object |
Convenience class for managing configuration
Load the user‘s configuration file
# File lib/rs/config.rb, line 43 def self.load_rc(file = '~/.rs/rc') # Load user config load file rescue LoadError # No problem end
Emulate normal arbitrary accessors and the two suffixes, ! to mean to set the attribute to true, ? to query whether the attr can be considered true
# File lib/rs/config.rb, line 60 def method_missing(sym, *args, &block) a, suffix = sym.to_s[0...-1], sym.to_s[-1, 1] # Decide what to do case suffix when '=' @store[a.intern] = *args when '?' !!@store[a.intern] when '!' @store[a.intern] = true else @store[sym] end # sym[-1] end