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

Closed
headius opened this Issue Oct 3, 2013 · 2 comments

Projects

None yet

2 participants

@headius
Member
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
Member
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 atambo added a commit that referenced this issue Oct 3, 2013
@atambo atambo Add test for fix to #1078 dd08c7b
@atambo
Member
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