Skip to content

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

@headius

Description

@headius

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions