Method: Agnostic::Config#method_missing
- Defined in:
- lib/agnostic/config.rb
#method_missing(method, *args, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/agnostic/config.rb', line 7 def method_missing(method, *args, &block) if args.empty? @hash[method] ||= Config.new elsif block.nil? @hash[method] = args.size == 1 ? args.first : args else class << self; self end.class_eval do define_method(method){block.call(*args)} end end end |