{"id":17397840,"url":"https://github.com/bltavares/delegate-class","last_synced_at":"2026-04-23T09:32:05.375Z","repository":{"id":2318967,"uuid":"3279362","full_name":"bltavares/delegate-class","owner":"bltavares","description":"Wrap a whole class (including classes methods) into a delegate class","archived":false,"fork":false,"pushed_at":"2012-02-02T00:54:30.000Z","size":96,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T17:49:11.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/bltavares.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}},"created_at":"2012-01-27T01:53:21.000Z","updated_at":"2019-10-01T04:15:29.000Z","dependencies_parsed_at":"2022-09-05T14:50:23.012Z","dependency_job_id":null,"html_url":"https://github.com/bltavares/delegate-class","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bltavares/delegate-class","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bltavares%2Fdelegate-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bltavares%2Fdelegate-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bltavares%2Fdelegate-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bltavares%2Fdelegate-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bltavares","download_url":"https://codeload.github.com/bltavares/delegate-class/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bltavares%2Fdelegate-class/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32174470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T02:19:40.750Z","status":"ssl_error","status_checked_at":"2026-04-23T02:17:55.737Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-16T14:16:52.408Z","updated_at":"2026-04-23T09:32:05.337Z","avatar_url":"https://github.com/bltavares.png","language":"Ruby","readme":"# Delegate-class\n\nUsing the default ruby delegate library, this gem is used to wrap the class _AND_ instance methods of another class.\n(_Though I still don't know the real usage of it_)\n\nYou may want to use it like this:\n\n##Usage\n\nI found it can be used on these situations.\n\n\nLets say you are using Rails and has the model:\n\n```ruby\n   \nclass User \u003c ActiveRecord::Base\nend\n\n```\n\nAnd then you have an author delegator class, modified to make things like _#form_for_\n\n```ruby\nrequire \"delegate\"\n\nclass Author \u003c SimpleDelegator\n  def class\n    __getojb__.class\n  end\n\n  def bookmates\n    User.find(1)\n  end\n\n  def name\n   super + \"!\"\n  end\nend\n\n```\n\nIMO, there are two bad things in these code:\n\n 1. Redefine class\n 2. Referencing the class you should be delegating\n\nYou may change it to:\n\n```ruby\nrequire \"delegate/class\"\n\nclass Author \u003c ClassDelegator(User)\n  def bookmates\n    self.class.find(1)\n  end\n\n  def name\n   super + \"!\"\n  end\nend\n\n```\n\nNow, you are delegating the instance and class methods to the wrapped class/object\n\n## Instalation\n\n[![Build Status](https://secure.travis-ci.org/bltavares/delegate-class.png)](http://travis-ci.org/bltavares/delegate-class)\n\nIt's is simple.\n\nAdd to your gem file\n\n```ruby\n    gem \"delegate/class\"\n```\n\nAnd run\n\n```bash\n    bundle install\n```\n\nHope you like it (:\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbltavares%2Fdelegate-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbltavares%2Fdelegate-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbltavares%2Fdelegate-class/lists"}