aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/deprecation/proxy_wrappers.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #36557 from ↵Matthew Draper2019-07-161-3/+24
|\ | | | | | | | | sikachu/fix-source-annotation-extractor-annotation Fix problem with accessing deprecated constant proxy's subclass
| * Fix problem with accessing constant proxy subclassPrem Sichanugrist2019-07-051-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes #36313. After #32065 moved `SourceAnnotationExtractor` into `Rails` module, it broke the ability to access `SourceAnnotationExtractor::Annotate` directly as user would get this error: TypeError: Rails::SourceAnnotationExtractor is not a class/module This commit fixes the issue by making `DeprecatedConstantProxy` to inherit from `Module` and then defines `method_missing` and `const_missing` to retain the previous functionality. Thank you Matthew Draper for the idea of how to fix the issue! [Prem Sichanugrist & Matthew Draper]
* | Rely on Kernel require instead of self requireBenoit Tigeot2019-06-221-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this code (exctracted from derailed_benchmarks): ```ruby require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "rails", "~> 6.0.0.rc1", require: false end FILES = [ "rails/engine/configuration", "rails/source_annotation_extractor", "active_support/deprecation" ] module Kernel alias :original_require :require def require(file) Kernel.require(file) end class << self alias :original_require :require end end Kernel.define_singleton_method(:require) do |file| original_require(file) end FILES.each do |file| puts "requiring file: #{file}" require file end ``` It fails with Rails 6 and the change introduced by 32065 ``` requiring file: rails/engine/configuration requiring file: rails/source_annotation_extractor Traceback (most recent call last): 11: from repro_derailed.rb:33:in `<main>' 10: from repro_derailed.rb:33:in `each' 9: from repro_derailed.rb:35:in `block in <main>' 8: from repro_derailed.rb:21:in `require' 7: from repro_derailed.rb:30:in `block in <main>' 6: from repro_derailed.rb:30:in `require' 5: from /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1/gems/railties-6.0.0.rc1/lib/rails/source_annotation_extractor.rb:8:in `<top (required)>' 4: from /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.0.rc1/lib/active_support/deprecation/proxy_wrappers.rb:10:in `new' 3: from /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.0.rc1/lib/active_support/deprecation/proxy_wrappers.rb:10:in `new' 2: from /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.0.rc1/lib/active_support/deprecation/proxy_wrappers.rb:125:in `initialize' 1: from /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.0.rc1/lib/active_support/deprecation/proxy_wrappers.rb:23:in `method_missing' /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.0.rc1/lib/active_support/deprecation/proxy_wrappers.rb:148:in `warn': private method `warn' called for nil:NilClass (NoMethodError) ``` Related: - https://github.com/schneems/derailed_benchmarks/pull/130 - https://github.com/rails/rails/pull/32065
* Remove unused `require "active_support/core_ext/regexp"`Ryuta Kamizono2018-07-291-2/+0
| | | | | | | | Ruby 2.4 has native `Regexp#match?`. https://ruby-doc.org/core-2.4.0/Regexp.html#method-i-match-3F Related #32034.
* Formatting fix for example codeT.J. Schuck2017-11-281-1/+1
| | | | | | | | | | | | | | | | Just cleaning up the formatting of the example code here to format an inline bit of commentary as a comment. Before: ![](https://monosnap.com/file/Clso8IQGOWHU3o6cStbY5NaMPx3ysP.png) After: ![](https://monosnap.com/file/QdbKKvLAeiQ0RucppVYETvaWEstnOI.png) [ci skip]
* Deprecate ActiveSupport::Inflector#acronym_regexNick LaMuro2017-10-281-1/+2
| | | | | | | | | To be removed in Rails 6.0 (default for the deprecate helper). Code moved around as well for the ActiveSupport::Deprecation modules, since it was dependent on ActiveSupport::Inflector being loaded for it to work. By "lazy loading" the Inflector code from within the Deprecation code, we can require ActiveSupport::Deprecation from ActiveSupport::Inflector and not get a circular dependency issue.
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* Change ActionView ERB Handler from Erubis to ErubiJeremy Evans2017-01-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Erubi offers the following advantages for Rails: * Works with ruby's --enable-frozen-string-literal option * Has 88% smaller memory footprint * Does no freedom patching (Erubis adds a method to Kernel) * Has simpler internals (1 file, <150 lines of code) * Has an open development model (Erubis doesn't have a public source control repository or bug tracker) * Is not dead (Erubis hasn't been updated since 2011) Erubi is a simplified fork of Erubis that contains just the parts that are generally needed (which includes the parts that Rails uses). The only intentional difference in behavior is that it does not include support for <%=== tags for debug output. That could be added to the ActionView ERB handler if it is desired. The Erubis template handler remains in a deprecated state so that code that accesses it directly does not break. It can be removed after Rails 5.1.
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* systematic revision of =~ usage in ASXavier Noria2016-07-221-1/+2
| | | | | Where appropriate prefer the more concise Regexp#match?, String#include?, String#start_with?, and String#end_with?
* [ci skip] Fix one more typoPrathamesh Sonpatki2016-01-301-1/+1
| | | | - Followup of https://github.com/rails/docrails/commit/10bc49710b7205a6172c3e072b3c77114fefd952
* [ci skip] Fix typoyui-knk2016-01-271-1/+1
|
* Documentation typoAkira Matsuda2015-09-201-1/+1
| | | | [ci skip]
* use `caller_locations` instead of `caller`Aaron Patterson2015-08-241-1/+1
| | | | | We have `caller_locations`, so we don't need to parse the strings in the callstack.
* A few documentation tweaks [ci skip]Robin Dupret2015-06-071-1/+1
| | | | [Robin Dupret & Shunsuke Aida]
* s/contstant/constant re #20282 [ci skip]Zachary Scott2015-05-241-2/+2
|
* [skip ci] Add documentation for DeprecatedConstantProxy#classAnton Davydov2015-05-241-0/+5
|
* Tiny documentation edits [ci skip]Robin Dupret2015-05-041-14/+16
| | | | | | * Fix a few typos * Wrap lines to 80 chars * Use `+` instead of `<tt>`
* [ci skip] Rework docs, add examples on deprecation proxiesNick Cox2015-04-241-22/+38
|
* Fix typos in deprecation proxy docs [ci skip]Carlos Antonio da Silva2013-04-301-3/+3
|
* Update activesupport/lib/active_support/deprecation/proxy_wrappers.rbClaudio B.2012-12-071-1/+1
| | | Fix a typo in rdoc (*expect* for *except*)
* Copy-edit deprecation relared documentation [ci skip]Rafael Mendonça França2012-09-131-22/+23
|
* Change ActiveSupport::Deprecation to class.Piotr Niełacny2012-09-131-10/+49
| | | | | | | | | | | | | | | | | | | | | | | | ActiveSupport::Deprecation is now a class rather than a module. You can get instance of ActiveSupport::Deprecation calling #instance method. ActiveSupport::Deprecation.instance But when you need to get new object od ActiveSupport::Deprecation you need to just call #new. @instance = ActiveSupport::Deprecation.new Since you can create a new object, you can change the version and the name of the library where the deprecator concerned. ActiveSupport::Deprecation.new('2.0', 'MyGem') If you need use another deprecator instance you can select it in the options of deprecate method. deprecate :method, :deprecator => deprecator_instance Documentation has been updated.
* extend ActiveSupport::Deprecation with self, allow other objects to ↵Robert Pankowecki2012-09-131-7/+12
| | | | | | | | | | extend/include it also. test local deprecation deprecator object Test ActiveSupport::Deprecation when included
* In AS, only inflector/methods is need in proxy_wrappers.rb, as well as date, ↵Josh Kalderimis2011-01-121-1/+1
| | | | | | date_time, and time conversions.rb. This fixes an issue when requiring json and AS saying that i18n is also required. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Prevent any warnings from being printed during RDoc generationJoost Baaij2010-08-261-1/+1
|
* fixing space errorsAaron Patterson2010-07-261-2/+2
|
* Override new on proxy objects so that they never wrap nil or false.Leigh Caplan2010-07-261-0/+7
|
* Don't undefine object_idJeremy Kemper2009-04-261-1/+1
|
* Fix dependencies revealed by testing in isolationJeremy Kemper2009-04-221-1/+3
|
* Dice up ActiveSupport::DeprecationJeremy Kemper2009-04-171-0/+72