<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/lib/delegate.rb, branch v2_7_8</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Fix SimpleDelegator respond_to? regression</title>
<updated>2020-03-15T10:35:24+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2020-02-03T11:29:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c6944377d798e088042f2944b81aa3fa8a4e5411'/>
<id>c6944377d798e088042f2944b81aa3fa8a4e5411</id>
<content type='text'>
In 2.6, SimpleDelegator would always use the target `respond_to?`

In 2.7.0 it doesn't if the target does not inherit from Object.

This breaks compatibility for delegated objects that inherit
from BasicObject and redefine `respond_to?`. [Bug #16606]

(cherry picked from commit f2552216d43040cd42bbb9fd484eab6c70856fe6)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In 2.6, SimpleDelegator would always use the target `respond_to?`

In 2.7.0 it doesn't if the target does not inherit from Object.

This breaks compatibility for delegated objects that inherit
from BasicObject and redefine `respond_to?`. [Bug #16606]

(cherry picked from commit f2552216d43040cd42bbb9fd484eab6c70856fe6)
</pre>
</div>
</content>
</entry>
<entry>
<title>delegate.rb: fixed keyword arguments in DelegateClass</title>
<updated>2020-03-15T10:35:24+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2020-01-21T02:47:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d07a6dc10efa71123b36a4a3ff7d2ec6e52804d7'/>
<id>d07a6dc10efa71123b36a4a3ff7d2ec6e52804d7</id>
<content type='text'>
`Delegator.delegating_block` should delegate keyword arguments
separately.  [ruby-core:96949]

(cherry picked from commit 9bcf4f3db26249772c983896ebbc9ff41f4614db)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`Delegator.delegating_block` should delegate keyword arguments
separately.  [ruby-core:96949]

(cherry picked from commit 9bcf4f3db26249772c983896ebbc9ff41f4614db)
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate taint/trust and related methods, and make the methods no-ops</title>
<updated>2019-11-17T23:00:25+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-25T03:59:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ffd0820ab317542f8780aac475da590a4bdbc7a8'/>
<id>ffd0820ab317542f8780aac475da590a4bdbc7a8</id>
<content type='text'>
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
</pre>
</div>
</content>
</entry>
<entry>
<title>Support delegates for BasicObject</title>
<updated>2019-10-10T20:15:00+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-08-25T07:04:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2322c94dd65c0247b103e2f91411e37458e1466d'/>
<id>2322c94dd65c0247b103e2f91411e37458e1466d</id>
<content type='text'>
For BasicObject, bind the Kernel respond_to? instance method to the
object and call it instead of calling the method directly.

Also, use bind_call(recv, ...) for better performance.

Fixes [Bug #16127]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For BasicObject, bind the Kernel respond_to? instance method to the
object and call it instead of calling the method directly.

Also, use bind_call(recv, ...) for better performance.

Fixes [Bug #16127]
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Module#ruby2_keywords for passing keywords through regular argument splats</title>
<updated>2019-09-25T19:33:52+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-21T16:03:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3b302ea8c95d34d5ef072d7e3b326f28a611e479'/>
<id>3b302ea8c95d34d5ef072d7e3b326f28a611e479</id>
<content type='text'>
This approach uses a flag bit on the final hash object in the regular splat,
as opposed to a previous approach that used a VM frame flag.  The hash flag
approach is less invasive, and handles some cases that the VM frame flag
approach does not, such as saving the argument splat array and splatting it
later:

  ruby2_keywords def foo(*args)
    @args = args
    bar
  end
  def bar
    baz(*@args)
  end
  def baz(*args, **kw)
    [args, kw]
  end
  foo(a:1)    #=&gt; [[], {a: 1}]
  foo({a: 1}, **{}) #=&gt; [[{a: 1}], {}]

  foo({a: 1}) #=&gt; 2.7: [[], {a: 1}] # and warning
  foo({a: 1}) #=&gt; 3.0: [[{a: 1}], {}]

It doesn't handle some cases that the VM frame flag handles, such as when
the final hash object is replaced using Hash#merge, but those cases are
probably less common and are unlikely to properly support keyword
argument separation.

Use ruby2_keywords to handle argument delegation in the delegate library.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This approach uses a flag bit on the final hash object in the regular splat,
as opposed to a previous approach that used a VM frame flag.  The hash flag
approach is less invasive, and handles some cases that the VM frame flag
approach does not, such as saving the argument splat array and splatting it
later:

  ruby2_keywords def foo(*args)
    @args = args
    bar
  end
  def bar
    baz(*@args)
  end
  def baz(*args, **kw)
    [args, kw]
  end
  foo(a:1)    #=&gt; [[], {a: 1}]
  foo({a: 1}, **{}) #=&gt; [[{a: 1}], {}]

  foo({a: 1}) #=&gt; 2.7: [[], {a: 1}] # and warning
  foo({a: 1}) #=&gt; 3.0: [[{a: 1}], {}]

It doesn't handle some cases that the VM frame flag handles, such as when
the final hash object is replaced using Hash#merge, but those cases are
probably less common and are unlikely to properly support keyword
argument separation.

Use ruby2_keywords to handle argument delegation in the delegate library.
</pre>
</div>
</content>
</entry>
<entry>
<title>delegate.rb: markup method names</title>
<updated>2019-06-01T15:34:02+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-06-01T15:34:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8a041c1b92b5dcc52908155ba1ca6c9f44a471cb'/>
<id>8a041c1b92b5dcc52908155ba1ca6c9f44a471cb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix visibility of some methods when using DelegateClass</title>
<updated>2019-05-31T01:34:45+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-05-24T04:10:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e8c710b11a02c6ab82b358fc671a14f378cb1974'/>
<id>e8c710b11a02c6ab82b358fc671a14f378cb1974</id>
<content type='text'>
Public instance methods added to a delegated class after the
creation of the delegate class were not returned by the
public_instance_methods class method of the delegate class.

Protected instance methods in the delegated class when the
delegate class is created were returned by the public_methods
instance method of the delegate class.

Patch mostly from Kenichi Kamiya &lt;kachick1@gmail.com&gt; in
GitHub pull request 926.  Minor changes to get it to apply,
and to fix tests after applying by me.

Fixes [Bug #11512]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Public instance methods added to a delegated class after the
creation of the delegate class were not returned by the
public_instance_methods class method of the delegate class.

Protected instance methods in the delegated class when the
delegate class is created were returned by the public_methods
instance method of the delegate class.

Patch mostly from Kenichi Kamiya &lt;kachick1@gmail.com&gt; in
GitHub pull request 926.  Minor changes to get it to apply,
and to fix tests after applying by me.

Fixes [Bug #11512]
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow DelegateClass() to module_eval given block</title>
<updated>2019-05-31T01:34:45+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-05-11T23:32:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1cd93f1cdfbe6f7e71b05b3f8e707f21d70e94ba'/>
<id>1cd93f1cdfbe6f7e71b05b3f8e707f21d70e94ba</id>
<content type='text'>
Methods that return classes often module_eval the given block
(e.g. Class.new and Struct.new).  This allows DelegateClass to
work similarly.  This makes it easier to use DelegateClass
directly without subclassing, so as not to create an unnecessary
subclass.

Implements [Feature #15842]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Methods that return classes often module_eval the given block
(e.g. Class.new and Struct.new).  This allows DelegateClass to
work similarly.  This makes it easier to use DelegateClass
directly without subclassing, so as not to create an unnecessary
subclass.

Implements [Feature #15842]
</pre>
</div>
</content>
</entry>
<entry>
<title>delegate.rb: don't look for methods on Kernel</title>
<updated>2019-05-13T02:29:42+00:00</updated>
<author>
<name>Étienne Barrié</name>
<email>etienne.barrie@gmail.com</email>
</author>
<published>2016-08-30T17:29:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60'/>
<id>2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60</id>
<content type='text'>
Instead, look for instance methods of Kernel.
Otherwise, instance methods of Module (which are methods of Kernel
itself) are mistakenly believed to exist, and it fails when calling
Kernel.instance_method().

Closes: https://github.com/ruby/ruby/pull/1422
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead, look for instance methods of Kernel.
Otherwise, instance methods of Module (which are methods of Kernel
itself) are mistakenly believed to exist, and it fails when calling
Kernel.instance_method().

Closes: https://github.com/ruby/ruby/pull/1422
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix missing `\A`</title>
<updated>2019-05-10T03:21:43+00:00</updated>
<author>
<name>Kazuhiro NISHIYAMA</name>
<email>zn@mbf.nifty.com</email>
</author>
<published>2019-05-10T03:21:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c8a891d1aa2fd54172d313441811aef2838b7797'/>
<id>c8a891d1aa2fd54172d313441811aef2838b7797</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
