Changeset 5547
- Timestamp:
- 11/17/06 14:09:46 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/lib/active_support/deprecation.rb
r5535 r5547 38 38 end 39 39 40 # Silence deprecations for the duration of the provided block. For internal 41 # use only. 40 # Silence deprecation warnings within the block. 42 41 def silence 43 old_silenced, @silenced = @silenced, true # We could have done behavior = nil...42 old_silenced, @silenced = @silenced, true 44 43 yield 45 44 ensure … … 154 153 155 154 private 155 def method_missing(called, *args, &block) 156 warn caller, called, args 157 target.__send__(called, *args, &block) 158 end 159 160 def target 161 @instance.__send__(@method) 162 end 163 156 164 def warn(callstack, called, args) 157 165 ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) 158 end159 160 def method_missing(called, *args, &block)161 warn caller, called, args162 @instance.__send__(@method).__send__(called, *args, &block)163 166 end 164 167 end