Skip to content

Making this work on a passable instance of a binding? #2

@markburns

Description

@markburns

Hi, I like how concise this gem is. Just found it by looking at binding_of_caller.

One thing that doesn't work with binding_of_caller is:

require "binding_of_caller"

def determine_binding
  get_binding_from_here
end

def get_binding_from_here
  binding
end

def container_method
  called_method(determine_binding)
end

def called_method(other_binding)
  puts other_binding.of_caller(1).eval("__method__")
end

The output is container_method and not determine_binding.
I.e. the #of_caller method only acts like the current binding and not on the actual passed instance of the binding.

I'm thinking of opening an issue there, but it looks a bit unattended. So I imagine I might have to get my hands dirty.

And if I am going to do that, then maybe it's easier to start with your gem instead.

I've not really looked into the debug inspector side of things at all, so it could be that it's just not achievable.

Do you know off the top of your head if that is possible or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions