- 23 7月, 2019 1 次提交
-
-
由 Aaron Lipman 提交于
Exclude missing marshal_dump and _dump methods from being delegated to an object's delegation target via the delegate_missing_to extension. This avoids unintentionally adding instance variables to an object during marshallization, should the delegation target be a method which would otherwise add them. In current versions of Ruby, a bug exists in the way objects are marshalled, allowing for instance variables to be added or removed during marshallization (see https://bugs.ruby-lang.org/issues/15968). This results in a corrupted serialized byte stream, causing an object's instance variables to "leak" into subsequent serialized objects during demarshallization. In Rails, this behavior may be triggered when marshalling an object that uses the delegate_missing_to extension, if the delegation target is a method which adds or removes instance variables to an object being marshalled - when calling Marshal.dump(object), Ruby's built in behavior will check whether the object responds to :marshal_dump or :_dump, which in turn triggers the delegation target method in the responds_to_missing? function defined in activesupport/lib/active_support/core_ext/module/delegation.rb While future versions of Ruby will resolve this bug by raising a RuntimeError, the underlying cause of this error may not be readily apparent when encountered by Rails developers. By excluding marshal_dump and _dump from being delegated to an object's target, this commit eliminates a potential cause of unexpected behavior and/or RuntimeErrors. Fixes #36522
-
- 28 2月, 2018 1 次提交
-
-
由 bogdanvlviv 提交于
Remove extra comments `# Asking for private method` in activesupport/test/core_ext/module_test.rb Improve docs of using `delegate` with `:private` Update changelog of #31944
-
- 27 2月, 2018 1 次提交
-
-
由 Tomas Valent 提交于
-
- 26 1月, 2018 2 次提交
-
-
由 Daniel Colson 提交于
-
由 Daniel Colson 提交于
-
- 13 8月, 2017 1 次提交
-
-
由 Anton Khamets 提交于
* Add test for the new exception of delegate_missing_to * Add a changelog entry * Only check for nil if NoMethodError was raised * Make method private * Have to pass both target name and value * Inline the re-raise [Rafael Mendonça França + Anton Khamets]
-
- 11 7月, 2017 1 次提交
-
-
由 Koichi ITO 提交于
-
- 09 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 05 7月, 2017 2 次提交
-
-
由 Ryuta Kamizono 提交于
``` /Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:402: warning: `*' interpreted as argument prefix /Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:420: warning: `*' interpreted as argument prefix ```
-
由 Krzysztof Zych 提交于
-
- 02 7月, 2017 1 次提交
-
-
由 Matthew Draper 提交于
This reverts commit 3420a145, reversing changes made to afb66a5a.
-
- 01 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 05 5月, 2017 1 次提交
-
-
由 T.J. Schuck 提交于
The method is named `delegate_missing_to`, not `delegate_to_missing`
-
- 09 4月, 2017 2 次提交
-
-
由 Matthew Draper 提交于
-
由 Matthew Draper 提交于
So we shouldn't claim they're there, even when asked explicitly.
-
- 18 1月, 2017 1 次提交
-
-
由 Corey Ward 提交于
-
- 13 1月, 2017 2 次提交
-
-
由 Akira Matsuda 提交于
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
- 26 12月, 2016 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 14 11月, 2016 2 次提交
-
-
由 Andrew White 提交于
-
由 Andrew White 提交于
-
- 29 10月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 16 8月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
-
- 07 8月, 2016 4 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
-
- 27 5月, 2016 1 次提交
-
-
由 Jon Moss 提交于
-
- 25 5月, 2016 2 次提交
-
-
由 Yosuke Kabuto 提交于
-
由 Rafael Mendonça França 提交于
And make sure that it doesn't even try to call the method in the target.
-
- 02 3月, 2016 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 01 3月, 2016 1 次提交
-
-
由 yui-knk 提交于
After Ruby 1.9, we can easily get the constants that have been defined locally by `Module.constants(false)`.
-
- 28 2月, 2016 1 次提交
-
-
由 Genadi Samokovarov 提交于
When building decorators, a common pattern may emerge: class Partition def initialize(first_event) @events = [ first_event ] end def people if @events.first.detail.people.any? @events.collect { |e| Array(e.detail.people) }.flatten.uniq else @events.collect(&:creator).uniq end end private def respond_to_missing?(name, include_private = false) @events.respond_to?(name, include_private) end def method_missing(method, *args, &block) @events.send(method, *args, &block) end end With `Module#delegate_missing_to`, the above is condensed to: class Partition delegate_missing_to :@events def initialize(first_event) @events = [ first_event ] end def people if @events.first.detail.people.any? @events.collect { |e| Array(e.detail.people) }.flatten.uniq else @events.collect(&:creator).uniq end end end David suggested it in #23824.
-
- 20 8月, 2015 1 次提交
-
-
由 Jake Bell 提交于
-
- 23 3月, 2015 1 次提交
-
-
由 Kir Shatrov 提交于
…as discussed #19413
-
- 12 2月, 2015 1 次提交
-
-
由 Rafael Mendonça França 提交于
This caused a performance regression since we were decided to do the nil check in run time not in the load time. See https://github.com/rails/rails/pull/15187#issuecomment-71760058
-
- 19 9月, 2014 1 次提交
-
-
由 Agis- 提交于
Fixes #16956.
-
- 20 5月, 2014 1 次提交
-
-
由 Vladimir Yarotsky 提交于
-
- 17 1月, 2014 2 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Aaron Patterson 提交于
sup haters
-