Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefine SimpleDelegator#open due to private method interference #449

Closed
wants to merge 2 commits into from

Conversation

@JonRowe
Copy link

JonRowe commented Nov 14, 2013

Including ::Kernel.dup brings across the #open method into
SimpleDelegator with undesirable consequences.

e.g.

class A
  def open
  end
end

SimpleDelegator.new(A.new).open
# => nil

SimpleDelegator.new(A.new).send :open
# ArgumentError: wrong number of arguments (0 for 1..3)

/cc @nobu this shows the real problem
JonRowe added 2 commits Nov 14, 2013
Including `::Kernel.dup` brings across the #open method into
SimpleDelegator with undesirable consequences.

e.g.

```Ruby
  class A
  end
  SimpleDelegator.new(A.new).open
  # => NoMethodError: private method `open' called for #<A:0x007fca1aa1fbd0>
```
@nobu nobu closed this in ca57399 Nov 15, 2013
@JonRowe JonRowe deleted the JonRowe:fix_issue_with_delegate_and_open branch Nov 15, 2013
mmasaki pushed a commit to mmasaki/ruby that referenced this pull request Nov 15, 2013
* lib/delegate.rb (Delegator#send): override to get rid of global function interference.
  [Fixes rubyGH-449]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
nobu added a commit that referenced this pull request Nov 21, 2013
* lib/delegate.rb (Delegator#method_missing): try private methods defined in
  Kernel after the target.  [Fixes GH-449]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mmasaki pushed a commit to mmasaki/ruby that referenced this pull request Nov 21, 2013
* lib/delegate.rb (Delegator#method_missing): try private methods defined in
  Kernel after the target.  [Fixes rubyGH-449]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
tenderlove pushed a commit to tenderlove/ruby that referenced this pull request Jan 24, 2014
* lib/delegate.rb (Delegator#send): override to get rid of global function interference.
  [Fixes rubyGH-449]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
tenderlove pushed a commit to tenderlove/ruby that referenced this pull request Jan 24, 2014
* lib/delegate.rb (Delegator#method_missing): try private methods defined in
  Kernel after the target.  [Fixes rubyGH-449]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
evanphx pushed a commit that referenced this pull request Apr 30, 2014
	* lib/delegate.rb (Delegator#send): override to get rid of global function interference.
	  [Fixes GH-449]

	* lib/delegate.rb (Delegator#send): separate from method_missing so
	  that super calls proper method.

	* lib/delegate.rb (Delegator#method_missing): try private methods defined in
	  Kernel after the target.  [Fixes GH-449]

	* lib/delegate.rb (SimpleDelegator#__getobj__): target object must be set.

	* lib/delegate.rb (DelegateClass#__getobj__): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hsbt pushed a commit that referenced this pull request Mar 10, 2015
	* lib/delegate.rb (Delegator#send): override to get rid of global function interference.
	  [Fixes GH-449]

	* lib/delegate.rb (Delegator#send): separate from method_missing so
	  that super calls proper method.

	* lib/delegate.rb (Delegator#method_missing): try private methods defined in
	  Kernel after the target.  [Fixes GH-449]

	* lib/delegate.rb (SimpleDelegator#__getobj__): target object must be set.

	* lib/delegate.rb (DelegateClass#__getobj__): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.