module Trying

Public Instance Methods

trying(&block) click to toggle source
# File lib/trying.rb, line 36
def trying(&block)
  proxy = Proxy.new(self)
  bound = binding()
  result = nil

  obj = proxy.instance_eval do
    proxy = bound.local_variable_get(:proxy)
    proxy.cell = proxy.instance_eval(&block)
    bound.local_variable_set(:proxy, proxy)
  end

  obj.cell
end