def call_or_yield(object)
      caller_method = caller_locations(1,1)[0].label
      if object.respond_to?(caller_method)
        object.public_send(caller_method)
      else
        yield
      end
    end
def call_or_yield(object)
      caller_method = caller_locations(1,1)[0].label
      if object.respond_to?(caller_method)
        object.public_send(caller_method)
      else
        yield
      end
    end
def call_or_yield ( object ) caller_method = caller_locations ( 1 , 1 ) [ 0 ] . label if object . respond_to? ( caller_method ) object . public_send ( caller_method ) else yield end end
Calls caller method on object if defined, otherwise yields to block
Calls caller method on object if defined otherwise yields to block