{"id":20019672,"url":"https://github.com/kddnewton/hollaback","last_synced_at":"2025-05-04T23:32:03.413Z","repository":{"id":37531330,"uuid":"68858779","full_name":"kddnewton/hollaback","owner":"kddnewton","description":"Add callbacks to your methods","archived":false,"fork":false,"pushed_at":"2025-04-28T18:20:47.000Z","size":386,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-04T06:36:02.202Z","etag":null,"topics":["gem","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/kddnewton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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},"funding":{"github":"kddnewton"}},"created_at":"2016-09-21T21:25:06.000Z","updated_at":"2025-04-28T18:20:51.000Z","dependencies_parsed_at":"2023-02-14T18:31:51.064Z","dependency_job_id":"29d11c66-d0b4-4199-bcec-db37d0af2fbd","html_url":"https://github.com/kddnewton/hollaback","commit_stats":{"total_commits":165,"total_committers":5,"mean_commits":33.0,"dds":0.2606060606060606,"last_synced_commit":"6f35dd5f5829d43354b8eaf630089fd34f99da1b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kddnewton%2Fhollaback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kddnewton%2Fhollaback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kddnewton%2Fhollaback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kddnewton%2Fhollaback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kddnewton","download_url":"https://codeload.github.com/kddnewton/hollaback/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252414444,"owners_count":21744108,"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":["gem","ruby"],"created_at":"2024-11-13T08:28:24.071Z","updated_at":"2025-05-04T23:32:03.042Z","avatar_url":"https://github.com/kddnewton.png","language":"Ruby","funding_links":["https://github.com/sponsors/kddnewton"],"categories":[],"sub_categories":[],"readme":"# Hollaback\n\n[![Build Status](https://github.com/kddnewton/hollaback/workflows/Main/badge.svg)](https://github.com/kddnewton/hollaback/actions)\n[![Gem Version](https://img.shields.io/gem/v/hollaback.svg)](https://rubygems.org/gems/hollaback)\n\nBuilds method chains such that you can execute functions inside of a predefined set of callbacks.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"hollaback\"\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install hollaback\n\n## Usage\n\nSometimes you want to execute code in the context of hooks. With this gem you can build `before`, `after`, and `around` callbacks that are executed in the context of the given object. For `before`s and `after`s you can use either symbols or procs. For `around`s you can use symbols.\n\nFirst, create a `Hollaback::Chain` object that will represent all of the callbacks that will be called around a block of code.\n\n```ruby\nrequire \"hollaback\"\nchain = Hollaback::Chain.new\n```\n\nThen, specify the callbacks that will be called.\n\n```ruby\nchain.before :say_hello\nchain.before { puts \"How are you?\" }\nchain.after :say_goodbye\nchain.around :say\n```\n\nThen, provide a block of code around which the callbacks will be called.\n\n```ruby\ncompiled = chain.compile { \"- Hollaback\" }\n```\n\nFinally, call the compiled sequence of callbacks (with or without an optional context object on which the symbol callbacks should be defined).\n\n```ruby\nclass Callbacker\n  def say_hello\n    puts \"Hello!\"\n  end\n\n  def say_goodbye\n    puts \"Goodbye!\"\n  end\n\n  def say(\u0026block)\n    puts \"speaking... \"\n    puts yield\n    puts \"...done.\"\n  end\nend\n\ncompiled.call(Callbacker.new)\n```\n\nIn the above example, the following will output to stdout:\n\n```\nspeaking... \nHello!\nHow are you?\nGoodbye!\n- Hollaback\n...done.\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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/kddnewton/hollaback.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkddnewton%2Fhollaback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkddnewton%2Fhollaback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkddnewton%2Fhollaback/lists"}