{"id":16946055,"url":"https://github.com/lsegal/force_bind","last_synced_at":"2025-04-11T16:30:57.497Z","repository":{"id":613469,"uuid":"251575","full_name":"lsegal/force_bind","owner":"lsegal","description":"Adds UnboundMethod#bind_class to bind an UnboundMethod to a class.","archived":false,"fork":false,"pushed_at":"2011-01-10T21:09:59.000Z","size":621,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-31T06:51:31.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/lsegal.png","metadata":{"files":{"readme":"README","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":"2009-07-15T06:23:57.000Z","updated_at":"2013-09-30T21:51:21.000Z","dependencies_parsed_at":"2022-07-15T02:00:48.774Z","dependency_job_id":null,"html_url":"https://github.com/lsegal/force_bind","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fforce_bind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fforce_bind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fforce_bind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fforce_bind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsegal","download_url":"https://codeload.github.com/lsegal/force_bind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223472809,"owners_count":17150745,"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-13T21:24:51.882Z","updated_at":"2024-11-07T07:05:53.373Z","avatar_url":"https://github.com/lsegal.png","language":"C","readme":"= force_bind\n\nAdds UnboundMethod#force_bind to bind an unbound method to class (or any object of any type).\nIt basically bypasses the argument type checking that #bind has.\n\n== Requirements\n\n* Ruby 1.9.1 or greater (does not work in Ruby 1.8.x)\n\n== Example\n\nBind an instance method to its class (making it act like a class method):\n\n  class Foo\n    def bar\n      puts \"I'm inside #{self}\"\n    end\n  end\n  \n  Foo.new.bar\n  #=\u003e \"I'm inside #\u003cFoo:0x123456\u003e\"\n  \n  meth = Foo.instance_method(:bar).force_bind(Foo)\n  meth.call\n  #=\u003e \"I'm inside Foo\"\n    \nYou can also use this to rebind the instance method of any object to any\nother object:\n\n  class A\n    def foo; self end\n  end\n  \n  class B; end\n  \n  meth = A.instance_method(:foo).force_bind(B.new)\n  meth.call\n  #=\u003e #\u003cB:0x123456\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsegal%2Fforce_bind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsegal%2Fforce_bind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsegal%2Fforce_bind/lists"}