{"id":16656369,"url":"https://github.com/wnuqui/defined_methods","last_synced_at":"2025-04-09T18:21:23.086Z","repository":{"id":54760023,"uuid":"125710266","full_name":"wnuqui/defined_methods","owner":"wnuqui","description":"DefinedMethods is a utility module that returns methods defined in a given object.","archived":false,"fork":false,"pushed_at":"2021-01-31T11:56:01.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T11:42:06.279Z","etag":null,"topics":["class","methods","module"],"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/wnuqui.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-03-18T09:36:36.000Z","updated_at":"2023-03-10T09:29:28.000Z","dependencies_parsed_at":"2022-08-14T02:00:46.298Z","dependency_job_id":null,"html_url":"https://github.com/wnuqui/defined_methods","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnuqui%2Fdefined_methods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnuqui%2Fdefined_methods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnuqui%2Fdefined_methods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnuqui%2Fdefined_methods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wnuqui","download_url":"https://codeload.github.com/wnuqui/defined_methods/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085495,"owners_count":21045168,"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":["class","methods","module"],"created_at":"2024-10-12T09:57:09.882Z","updated_at":"2025-04-09T18:21:23.068Z","avatar_url":"https://github.com/wnuqui.png","language":"Ruby","readme":"# DefinedMethods [![Build Status](https://wnuqui.semaphoreci.com/badges/defined_methods/branches/master.svg?style=shields)](https://wnuqui.semaphoreci.com/projects/defined_methods) [![Test Coverage](https://api.codeclimate.com/v1/badges/e6e5eb81d01758314813/test_coverage)](https://codeclimate.com/github/wnuqui/defined_methods/test_coverage)\n\n`DefinedMethods` is a utility module that returns **methods defined in a given object**. These methods are NOT from included or extended modules. These methods are also NOT from parent objects. By object, it means either a `class` or `module`.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'defined_methods'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install defined_methods\n\n## Usage\n\nGiven a class:\n```ruby\nclass Arithmeter\n  def self.sum(a, b)\n    arithmeter = new\n    arithmeter.add a, b\n  end\n\n  def add(a, b)\n    do_add a, b\n  end\n\n  private\n\n  def do_add(a, b)\n    perform_addition a, b\n  end\n\n  protected\n\n  def perform_addition(a, b)\n    a + b\n  end\nend\n```\n\nWhen calling `DefinedMethods.in(Arithmeter)`, it will return\n```ruby\n[{:object_name=\u003e\"Arithmeter\",\n  :object=\u003e#\u003cClass:Arithmeter\u003e,\n  :methods=\u003e[:sum],\n  :private=\u003efalse,\n  :protected=\u003efalse,\n  :singleton=\u003etrue},\n {:object_name=\u003e\"Arithmeter\",\n  :object=\u003e#\u003cClass:Arithmeter\u003e,\n  :methods=\u003e[],\n  :private=\u003etrue,\n  :protected=\u003efalse,\n  :singleton=\u003etrue},\n {:object_name=\u003e\"Arithmeter\",\n  :object=\u003e#\u003cClass:Arithmeter\u003e,\n  :methods=\u003e[],\n  :private=\u003efalse,\n  :protected=\u003etrue,\n  :singleton=\u003etrue},\n {:object_name=\u003e\"Arithmeter\",\n  :object=\u003eArithmeter,\n  :methods=\u003e[:add],\n  :private=\u003efalse,\n  :protected=\u003efalse,\n  :singleton=\u003efalse},\n {:object_name=\u003e\"Arithmeter\",\n  :object=\u003eArithmeter,\n  :methods=\u003e[:do_add],\n  :private=\u003etrue,\n  :protected=\u003efalse,\n  :singleton=\u003efalse},\n {:object_name=\u003e\"Arithmeter\",\n  :object=\u003eArithmeter,\n  :methods=\u003e[:perform_addition],\n  :private=\u003efalse,\n  :protected=\u003etrue,\n  :singleton=\u003efalse}]\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` 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/wnuqui/defined_methods. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the DefinedMethods project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/defined_methods/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwnuqui%2Fdefined_methods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwnuqui%2Fdefined_methods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwnuqui%2Fdefined_methods/lists"}