Class: ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/active_support/deprecation.rb

Overview

Stand-in for @request, @attributes, @params, etc. which emits deprecation warnings on any method call (except inspect).

Instance Method Summary collapse

Constructor Details

#initialize(instance, method, var = "@#{method}") ⇒ DeprecatedInstanceVariableProxy

Returns a new instance of DeprecatedInstanceVariableProxy.


154
155
156
# File 'lib/active_support/deprecation.rb', line 154

def initialize(instance, method, var = "@#{method}")
  @instance, @method, @var = instance, method, var
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(called, *args, &block) ⇒ Object (private)


165
166
167
168
# File 'lib/active_support/deprecation.rb', line 165

def method_missing(called, *args, &block)
  warn caller, called, args
  target.__send__(called, *args, &block)
end

Instance Method Details

#inspectObject

Don't give a deprecation warning on inspect since test/unit and error logs rely on it for diagnostics.


160
161
162
# File 'lib/active_support/deprecation.rb', line 160

def inspect
  target.inspect
end