Method: Arrow::Config::ConfigStruct#method_missing
- Defined in:
- lib/arrow/config.rb
#method_missing(sym, *args) ⇒ Object (protected)
Handle calls to key-methods
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
# File 'lib/arrow/config.rb', line 525 def method_missing( sym, *args ) key = sym.to_s.sub( /(=|\?)$/, '' ).to_sym return nil unless @hash.key?( key ) self.class.class_eval { define_method( key ) { if @hash[ key ].is_a?( Hash ) @hash[ key ] = ConfigStruct.new( @hash[key] ) end @hash[ key ] } define_method( "#{key}?" ) {@hash[key] ? true : false} define_method( "#{key}=" ) {|val| @dirty = @hash[key] != val @hash[key] = val } } self.__send__( sym, *args ) end |