Created
July 1, 2012 21:47
-
-
Save ept/3029740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RegexTest | |
LAMBDAS = { | |
:one => lambda{|str| str[/(\w+)/, 1] }, | |
:two => lambda{ puts "$1 = #{$1}" } | |
} | |
end | |
RegexTest::LAMBDAS[:one].call('foo') | |
# => "foo" | |
RegexTest::LAMBDAS[:two].call | |
# prints "$1 = foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment