I have a defined a lambda function as
my_lambda = lambda { |x| 100 * x }
I am passing this function as an input to another function which needs to verify its identify, something like:
def function_verifier(func)
if func.to_s == "my_lambda"
return "ok"
else
return "mismatch!"
end
end
However when I pass my_lambda as input to this function, the command func.to_s returns "#<Proc:0x0000a973516680@(pry):14 (lambda)>" instead of "my_lambda".
How do I turn the function handle for my_lambda into the string "my_lambda"?
a = -> { }; b = a, what would you expect the name of the lambda to be and why? And what do you mean by "verify its identity"?lambas = {foo: ->() {}}