{"id":16946090,"url":"https://github.com/lsegal/metamorph","last_synced_at":"2025-04-11T19:33:44.548Z","repository":{"id":850188,"uuid":"579440","full_name":"lsegal/metamorph","owner":"lsegal","description":"Transparently defines instance methods inside anonymous module so mixins can override them with proper inheritance.","archived":false,"fork":false,"pushed_at":"2010-03-26T00:42:10.000Z","size":228,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T15:32:35.989Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsegal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-03-25T18:31:29.000Z","updated_at":"2021-01-13T19:28:37.000Z","dependencies_parsed_at":"2022-08-16T11:10:30.264Z","dependency_job_id":null,"html_url":"https://github.com/lsegal/metamorph","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/lsegal%2Fmetamorph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fmetamorph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fmetamorph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsegal%2Fmetamorph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsegal","download_url":"https://codeload.github.com/lsegal/metamorph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248467348,"owners_count":21108629,"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:56.394Z","updated_at":"2025-04-11T19:33:44.525Z","avatar_url":"https://github.com/lsegal.png","language":"Ruby","readme":"# Metamorph\n\nTransparently defines instance methods inside anonymous module so mixins can \noverride them with proper inheritance. This allows a user to extend any class\nwith modules and override default behaviour without resorting to `alias_method_chain`,\neven if the class defines the methods directly in the class body.\n\n## Usage\n\nMetamorph requires no special syntax or modification to source. Simply require\nthe library and all methods will be transparently redefined inside inner\nmodules.\n\n    require 'metamorph'\n    \n    class A\n      def foo; \"foo\" end\n    end\n    \n    A::InstanceMethods.instance_methods # =\u003e [:foo]\n    \n    module B\n      def foo; super + \"bar\" end\n    end\n    \n    A.new.foo # =\u003e \"foo\"\n    A.send(:include, B)\n    A.new.foo # =\u003e \"foobar\"\n\nWithout `metamorph`, the second `A.new.foo` would still return \"foo\", because\nthe definition of `foo` directly in the A class body takes precedence over\nany modules mixed in afterwards. Metamorph transparently changes this inheritance\nrule to prioritize the \"last\" define method.\n\n## Installing\n\n1. Install the gem:\n\n        sudo gem install metamorph\n\n2. Build manually:\n\n        rake build\n        gem build metamorph.gemspec\n        sudo gem install metamorph-VERSION.gem\n    \n## Known Issues\n\nMetamorph does not play well with codebases that perform a lot of \nmetaprogramming. Make sure to load metamorph *after* these libraries are\nloaded.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsegal%2Fmetamorph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsegal%2Fmetamorph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsegal%2Fmetamorph/lists"}