{"id":21679249,"url":"https://github.com/hoppergee/active_method","last_synced_at":"2025-04-12T05:43:05.568Z","repository":{"id":58053054,"uuid":"529636998","full_name":"hoppergee/active_method","owner":"hoppergee","description":"Refactor your obscure method to a method object","archived":false,"fork":false,"pushed_at":"2024-12-17T17:51:32.000Z","size":112,"stargazers_count":10,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T05:42:50.450Z","etag":null,"topics":["method-object","ruby"],"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/hoppergee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2022-08-27T16:22:31.000Z","updated_at":"2024-12-17T17:50:56.000Z","dependencies_parsed_at":"2024-11-25T22:31:39.493Z","dependency_job_id":null,"html_url":"https://github.com/hoppergee/active_method","commit_stats":{"total_commits":33,"total_committers":1,"mean_commits":33.0,"dds":0.0,"last_synced_commit":"fe7513e191cb1a0b5d720ceb3dfb996574492384"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Factive_method","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Factive_method/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Factive_method/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Factive_method/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoppergee","download_url":"https://codeload.github.com/hoppergee/active_method/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525160,"owners_count":21118616,"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":["method-object","ruby"],"created_at":"2024-11-25T14:49:58.188Z","updated_at":"2025-04-12T05:43:05.531Z","avatar_url":"https://github.com/hoppergee.png","language":"Ruby","readme":"# ActiveMethod\n\nMethod is an object in Ruby, but we need **a real method object**. Welcome to `ActiveMethod`!\n\n- **Clean scope** without module\n- **High maintainability** with tiny method objects\n- Make wrting OO **easy**, then writing OO **everywhere**\n\n![](./hero.png)\n\n## Installation\n\n```bash\n$ bundle add active_method\n```\n\n## API\n\n**It just do what a method do, and nothing else!**\n\n### Define method object\n\n```ruby\nclass User\n  include ActiveMethod\n\n  active_method :foo\n  active_method :bar, MyBar\n  active_method :build_one, class_method: true\nend\n\nmodule Util\n  active_method :parse_url, module_function: true\nend\n```\n\n### Declaring arguments\n\n```ruby\nclass Foo \u003c ActiveMethod::Base\n  argument :a\n  argument :b, default: 2\n  keyword_argument :c\n  keyword_argument :d, default: 4\n\n  def call\n    puts \"a: #{a}, b: #{b}, c: #{c}, d: #{d}\"\n  end\nend\n\nUser.new.foo('aa', 3, c: 'cc', d: 5)\n#=\u003e a: aa, b: 3, c: cc, d: 5\n```\n\n### Customize the owner name of the method\n\n```ruby\nclass User\n  include ActiveMethod\n  attr_accessor :name\n  attr_accessor :fromal_name\n  active_method :hi\nend\n\nclass Hi \u003c ActiveMethod::Base\n  onwer :support\n\n  def call\n    puts \"Hi, I'm a #{support.fromal_name}. Please call me #{user.name}\"\n  end\nend\n\nuser = User.new\nuser.name = 'ActiveMethod'\nuser.fromal_name = 'method object'\nuser.hi\n#=\u003e Hi, I'm a method objectc, please call me ActiveMethod\n```\n\n## Development\n\n```bash\nbundle install\nmeval rake # Run test\nmeval -a rake # Run tests against all Ruby versions and Rails versions\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/hoppergee/active_method. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/hoppergee/active_method/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the ActiveMethod project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hoppergee/active_method/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoppergee%2Factive_method","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoppergee%2Factive_method","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoppergee%2Factive_method/lists"}