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

Delegate does not pass block through when object does not implement method #1078

Closed
headius opened this issue Oct 3, 2013 · 2 comments
Closed
Milestone

Comments

@headius
Copy link
Member

@headius headius commented Oct 3, 2013

When the method being delegated to does not actually implement the called method, our native delegate logic (NativeDelegate) is not passing the block through to the call.

For example, this code produces an enumerator instead of the final array:

require 'delegate'

hash = { "key" => "value" }

class Wrapper < SimpleDelegator
end

wrapped_hash = Wrapper.new(hash)

wrapped_wrapped_hash = Wrapper.new(wrapped_hash)

p wrapped_wrapped_hash.map { |key, value| [key,value] }

Fix coming.

@headius headius closed this in 2a8ff74 Oct 3, 2013
@headius
Copy link
Member Author

@headius headius commented Oct 3, 2013

@atambo Can you turn your example into a test case? I'm trying to fix other things for release right now and will probably forget.

atambo added a commit that referenced this issue Oct 3, 2013
@atambo
Copy link
Member

@atambo atambo commented Oct 3, 2013

@headius, done in dd08c7b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants