diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-02-25 09:28:18 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-02-25 09:28:18 -0800 |
commit | 6b12d74026808a3014f1dff34481006a96e0f18f (patch) | |
tree | f4c4b21968d0b45ecf0b30dc2bbc916bed0466e9 /activesupport | |
parent | bf0f14579aa793f2ab29ec092c517d04e702dbe3 (diff) | |
download | rails-6b12d74026808a3014f1dff34481006a96e0f18f.tar.gz rails-6b12d74026808a3014f1dff34481006a96e0f18f.tar.bz2 rails-6b12d74026808a3014f1dff34481006a96e0f18f.zip |
Commented metaprogramming turned out to be noisier not clearer
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/proc.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/deprecation/method_wrappers.rb | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/core_ext/proc.rb b/activesupport/lib/active_support/core_ext/proc.rb index d50076a01e..71b413a88a 100644 --- a/activesupport/lib/active_support/core_ext/proc.rb +++ b/activesupport/lib/active_support/core_ext/proc.rb @@ -5,9 +5,9 @@ class Proc #:nodoc: block, time = self, Time.now object.class_eval do method_name = "__bind_#{time.to_i}_#{time.usec}" - define_method(method_name, &block) # define_method("__bind_1230458026_720454", &block) - method = instance_method(method_name) # method = instance_method("__bind_1230458026_720454") - remove_method(method_name) # remove_method("__bind_1230458026_720454") + define_method(method_name, &block) + method = instance_method(method_name) + remove_method(method_name) method end.bind(object) end diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb index cec8024b17..d0d8b577b3 100644 --- a/activesupport/lib/active_support/deprecation/method_wrappers.rb +++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb @@ -12,15 +12,15 @@ module ActiveSupport method_names.each do |method_name| target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation| target_module.module_eval(<<-end_eval, __FILE__, __LINE__ + 1) - def #{target}_with_deprecation#{punctuation}(*args, &block) # def generate_secret_with_deprecation(*args, &block) - ::ActiveSupport::Deprecation.warn( # ::ActiveSupport::Deprecation.warn( - ::ActiveSupport::Deprecation.deprecated_method_warning( # ::ActiveSupport::Deprecation.deprecated_method_warning( - :#{method_name}, # :generate_secret, - #{options[method_name].inspect}), # "You should use ActiveSupport::SecureRandom.hex(64)"), - caller # caller - ) # ) - send(:#{target}_without_deprecation#{punctuation}, *args, &block) # send(:generate_secret_without_deprecation, *args, &block) - end # end + def #{target}_with_deprecation#{punctuation}(*args, &block) + ::ActiveSupport::Deprecation.warn( + ::ActiveSupport::Deprecation.deprecated_method_warning( + :#{method_name}, + #{options[method_name].inspect}), + caller + ) + send(:#{target}_without_deprecation#{punctuation}, *args, &block) + end end_eval end end |