{"id":17159639,"url":"https://github.com/schmidt/overloading","last_synced_at":"2025-10-03T12:11:27.973Z","repository":{"id":66239703,"uuid":"289561233","full_name":"schmidt/overloading","owner":"schmidt","description":null,"archived":false,"fork":false,"pushed_at":"2020-08-22T20:23:45.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T19:49:15.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schmidt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-22T20:22:57.000Z","updated_at":"2020-08-26T20:29:56.000Z","dependencies_parsed_at":"2023-03-27T15:32:38.768Z","dependency_job_id":null,"html_url":"https://github.com/schmidt/overloading","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmidt%2Foverloading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmidt%2Foverloading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmidt%2Foverloading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmidt%2Foverloading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schmidt","download_url":"https://codeload.github.com/schmidt/overloading/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245294768,"owners_count":20591900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T22:14:46.536Z","updated_at":"2025-10-03T12:11:27.875Z","avatar_url":"https://github.com/schmidt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overloading\n\nThis is a little hack, that's bringing method overloading to Ruby. There's been\nothers that have done this before. And they've probably also done it more\nreliable or with less code or supporting more edge cases or all the that\ntogether. But for me this was just a little riddle to solve and to brush up my\nmeta programming skills.\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'overloading', git: 'https://github.com/schmidt/overloading'\n```\n\nAnd then execute:\n\n    $ bundle\n\n\n## Usage\n\n**My suggestion would be: Better don't use it!**\n\n**Named paramters are not supported. The behaviour for methods with named\nparameters is not defined.**\n\nYet, if you can't be stopped: This is how it's used.\n\n```ruby\nclass Example\n  include Overloading\n\n  def action(one)\n    :one_arg\n  end\n\n  def action(one, two)\n    :two_args\n  end\nend\n\nExample.new.action(1)    # =\u003e :one_arg\nExample.new.action(1, 2) # =\u003e :two_args\n```\n\n**Please note:** With `Overloading`, if you're calling a method with an\nincorrect number of arguments, then this will trigger a `NoMethodError` instead\nof an `ArgumentError`. Because with method overloading, calling a method with an\nunexpected number of arguments is closer to calling a method, that wasn't\ndefined. Also it was easier to manage inheritance this way.\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, and\npush git commits and tags.\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/schmidt/overloading.\n\nThe next step would be supporting methods with rest args, e.g. `def\nexample(*rest)` vs. `def example(first, *rest)`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschmidt%2Foverloading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschmidt%2Foverloading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschmidt%2Foverloading/lists"}