{"id":15032794,"url":"https://github.com/ruby/delegate","last_synced_at":"2025-05-16T11:05:12.683Z","repository":{"id":38456774,"uuid":"200772247","full_name":"ruby/delegate","owner":"ruby","description":"This library provides three different ways to delegate method calls to an object.","archived":false,"fork":false,"pushed_at":"2025-04-21T22:41:11.000Z","size":218,"stargazers_count":19,"open_issues_count":4,"forks_count":13,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-21T23:32:36.253Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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,"zenodo":null}},"created_at":"2019-08-06T03:49:26.000Z","updated_at":"2025-04-21T22:41:13.000Z","dependencies_parsed_at":"2023-01-31T10:31:06.087Z","dependency_job_id":"bc049eb8-142e-44e9-bddc-ffd65aa0dc96","html_url":"https://github.com/ruby/delegate","commit_stats":{"total_commits":163,"total_committers":34,"mean_commits":4.794117647058823,"dds":0.6871165644171779,"last_synced_commit":"1c9f9cb37de9c1baa31dad5f67b00f59b765e22a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdelegate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdelegate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdelegate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdelegate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/delegate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518384,"owners_count":22084374,"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":["ruby"],"created_at":"2024-09-24T20:19:27.776Z","updated_at":"2025-05-16T11:05:07.674Z","avatar_url":"https://github.com/ruby.png","language":"Ruby","readme":"# Delegator\n\nThis library provides three different ways to delegate method calls to an\nobject.  The easiest to use is SimpleDelegator.  Pass an object to the\nconstructor and all methods supported by the object will be delegated.  This\nobject can be changed later.\n\nGoing a step further, the top level DelegateClass method allows you to easily\nsetup delegation through class inheritance.  This is considerably more\nflexible and thus probably the most common use for this library.\n\nFinally, if you need full control over the delegation scheme, you can inherit\nfrom the abstract class Delegator and customize as needed.  (If you find\nyourself needing this control, have a look at Forwardable which is also in\nthe standard library.  It may suit your needs better.)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'delegate'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install delegate\n\n## Usage\n\nSimpleDelegator's implementation serves as a nice example of the use of\nDelegator:\n\n```ruby\nclass SimpleDelegator \u003c Delegator\n  def __getobj__\n    @delegate_sd_obj # return object we are delegating to, required\n  end\n\n  def __setobj__(obj)\n    @delegate_sd_obj = obj # change delegation object,\n                           # a feature we're providing\n  end\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ruby/delegate.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fdelegate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fdelegate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fdelegate/lists"}