https://github.com/dblock/ruby-overload
Overload Ruby methods at runtime.
https://github.com/dblock/ruby-overload
Last synced: 9 months ago
JSON representation
Overload Ruby methods at runtime.
- Host: GitHub
- URL: https://github.com/dblock/ruby-overload
- Owner: dblock
- License: mit
- Created: 2020-07-25T13:18:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-25T13:48:10.000Z (almost 6 years ago)
- Last Synced: 2025-08-22T19:02:51.287Z (9 months ago)
- Language: Ruby
- Size: 14.6 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
Ruby::Overload
==========
[](http://badge.fury.io/rb/ruby-overload)
[](https://travis-ci.org/dblock/ruby-overload)
Runtime method overloading behavior for Ruby from [this blog post](https://lucaguidi.com/2020/07/22/ruby-method-overloading/) by [@jodosha](https://www.github.com/jodosha). Incorporates changes from [ptolemybarnes/overlord](https://github.com/ptolemybarnes/overlord), performance improvements from [baweaver@](https://gist.github.com/jodosha/e3097ed693e9b7c255b658ac39c2e403#gistcomment-3388594), and other ideas from [this tweet](https://twitter.com/jodosha/status/1285850349845254144).
## Disclaimer
The original author of this idea, Luca Guidi, [does not recommend](https://twitter.com/jodosha/status/1285941282381139969) using this in production, but YOLO.
## Usage
```ruby
require 'ruby-overload'
class Foo
include Ruby::Overload
def call
puts "foo"
end
def call(arg)
puts "foo #{arg}"
end
end
foo = Foo.new
foo.call # => "foo"
foo.call(23) # => "foo 23"
```
## Contributing
You're encouraged to contribute to this gem. See [CONTRIBUTING](CONTRIBUTING.md) for details.
## Copyright and License
Copyright (c) 2020, Luca Guidi, Brandon Weaver, Daniel Doubrovkine and [Contributors](CHANGELOG.md).
This project is licensed under the [MIT License](LICENSE.md).
## Similar Projects
* [overloader](https://github.com/pocke/overloader)