Sha256: 15c1a53879ae1d813ccec17165b6f5aedd91571673cc37e4824fc08409e960bd
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
# MethodFound Intercept `method_missing` and do something useful with it. ## Installation Add to your Gemfile: ```ruby gem 'method_found', '~> 0.1.0' ``` And bundle it. ## Usage Include an instance of `MethodFound` with a regex to match and block which takes the method name, regex matches, and arguments and does something with it: ```ruby class Foo include(MethodFound.new(/\Asay_([a-z]+)/Z/) do |method_name, matches, *arguments| "#{matches[0]}!" end) end foo = Foo.new foo.say_hello #=> "hello!" foo.say_bye #=> "bye!" ``` ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
method_found-0.1.0 | README.md |