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

Changeset 5547

Show
Ignore:
Timestamp:
11/17/06 14:09:46 (2 years ago)
Author:
bitsweat
Message:

Improve readability.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/deprecation.rb

    r5535 r5547  
    3838      end 
    3939 
    40       # Silence deprecations for the duration of the provided block. For internal 
    41       # use only. 
     40      # Silence deprecation warnings within the block. 
    4241      def silence 
    43         old_silenced, @silenced = @silenced, true # We could have done behavior = nil... 
     42        old_silenced, @silenced = @silenced, true 
    4443        yield 
    4544      ensure 
     
    154153 
    155154      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 
    156164        def warn(callstack, called, args) 
    157165          ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) 
    158         end 
    159  
    160         def method_missing(called, *args, &block) 
    161           warn caller, called, args 
    162           @instance.__send__(@method).__send__(called, *args, &block) 
    163166        end 
    164167    end