Skip to content

Instantly share code, notes, and snippets.

@ept
Created July 1, 2012 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ept/3029740 to your computer and use it in GitHub Desktop.
Save ept/3029740 to your computer and use it in GitHub Desktop.
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