Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/branches/1-2-stable/activesupport/lib/active_support/option_merger.rb

Revision 5197, 0.6 kB (checked in by rick, 2 years ago)

Don't undefine #class in OptionMerger [Rick]

Line 
1 module ActiveSupport
2   class OptionMerger #:nodoc:
3     instance_methods.each do |method|
4       undef_method(method) if method !~ /^(__|instance_eval|class)/
5     end
6    
7     def initialize(context, options)
8       @context, @options = context, options
9     end
10    
11     private
12       def method_missing(method, *arguments, &block)
13         merge_argument_options! arguments
14         @context.send(method, *arguments, &block)
15       end
16      
17       def merge_argument_options!(arguments)
18         arguments << if arguments.last.respond_to? :to_hash
19           @options.merge(arguments.pop)
20         else
21           @options.dup
22         end 
23       end
24   end
25 end
Note: See TracBrowser for help on using the browser.