Skip to content

Instantly share code, notes, and snippets.

@gstark
Created July 26, 2012 18:50
Show Gist options
  • Save gstark/3183777 to your computer and use it in GitHub Desktop.
Save gstark/3183777 to your computer and use it in GitHub Desktop.
lambda_and_threequals.rb
>> matcher = lambda { |value| puts "value is #{value}"; value == "foo" }
=> #<Proc:0x0000000110219b28@(irb):14>
>> matcher === "foo"
=> false
>> matcher.call("foo")
value is foo
=> true
>>
@avdi
Copy link

avdi commented Jul 26, 2012

When I run it locally, under 1.9.3:

matcher = lambda { |value| puts "value is #{value}"; value == "foo" }
matcher === "foo"               # => true
matcher.call("foo")             # => true
# >> value is foo
# >> value is foo

@gstark
Copy link
Author

gstark commented Jul 26, 2012

Ah, silly me, still on 1.8.7 -- Waiting for JRuby to make 1.9 mode default (in the awesomely anticipated 1.7) and that Mountain Lion broke my ability to build 1.8.7

Thanks!

@avdi
Copy link

avdi commented Jul 26, 2012

The backports gem might help you out, not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment