{"id":19264442,"url":"https://github.com/dcsg/eventception","last_synced_at":"2025-08-18T07:15:36.301Z","repository":{"id":56844967,"uuid":"96713885","full_name":"dcsg/eventception","owner":"dcsg","description":"Eventception is a lightweight and simple Ruby Event System ","archived":false,"fork":false,"pushed_at":"2017-07-22T21:33:39.000Z","size":131,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T16:26:50.901Z","etag":null,"topics":["event-dispatcher","event-driven","events","jruby","ruby-gem"],"latest_commit_sha":null,"homepage":"https://dcsg.github.io/eventception/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcsg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-07-09T21:59:38.000Z","updated_at":"2017-07-22T21:29:26.000Z","dependencies_parsed_at":"2022-09-09T17:11:47.543Z","dependency_job_id":null,"html_url":"https://github.com/dcsg/eventception","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dcsg/eventception","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcsg%2Feventception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcsg%2Feventception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcsg%2Feventception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcsg%2Feventception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcsg","download_url":"https://codeload.github.com/dcsg/eventception/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcsg%2Feventception/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270957875,"owners_count":24675260,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["event-dispatcher","event-driven","events","jruby","ruby-gem"],"created_at":"2024-11-09T19:41:13.277Z","updated_at":"2025-08-18T07:15:36.278Z","avatar_url":"https://github.com/dcsg.png","language":"Ruby","readme":"## Eventception\n\n[![Build Status](https://travis-ci.org/dcsg/eventception.svg?branch=master)](https://travis-ci.org/dcsg/eventception) [![Code Climate](https://codeclimate.com/github/dcsg/eventception/badges/gpa.svg)](https://codeclimate.com/github/dcsg/eventception) [![Test Coverage](https://codeclimate.com/github/dcsg/eventception/badges/coverage.svg)](https://codeclimate.com/github/dcsg/eventception/coverage)\n\nEventception is a lightweight and simple Ruby Event System inspired on [Symfony Event Dispatcher](https://symfony.com/doc/current/components/event_dispatcher.html).\n\n## How to Install\n\nAdd the following to your `Gemfile`:\n```ruby\ngem 'eventception', '~\u003e 0.1.0'\n```\n\n## How to use\n\nYou can also read the [documentation](https://dcsg.github.io/eventception/).\n\n#### Events\nWhen an event is dispatched, it's identified by a unique name, which any number of listeners might be listening to. An Event instance is also created and passed to all of the listeners. As you'll see later, the Event object itself often contains data about the event being dispatched.\n\n#### The Dispatcher\nThe dispatcher is the central object of the event dispatcher system.\nIn general, a single dispatcher is created, which maintains a registry of listeners.\nWhen an event is dispatched via the dispatcher, it notifies all listeners registered with that event:\n\n```ruby\nrequire 'eventception'\n\ndispatcher = Eventception::Dispatcher.new\n```\n\n#### Adding Listeners\n\n```ruby\nrequire 'eventception'\nclass TodoListener\n  def on_creation(event)\n    puts \"created a new to-do with title: '#{event.todo.title}'\"\n  end\nend\n\nlistener = TodoListener.new\ndispatcher.add_listener(\n  event_name: 'todo.created',\n  listener: listener,\n  listener_method: 'on_creation'\n)\n```\n\n#### Creating and Dispatching an Event\n\n##### Creating the Event\n```ruby\nrequire 'eventception'\nclass TodoCreatedEvent \u003c Eventception::Event\n    NAME = 'todo.created'.freeze\n\n    attr_reader :todo\n\n    def initialize(todo)\n      @todo = todo\n    end\nend\n```\n\n##### Dispatching the Event\n```ruby\nclass Todo\n    attr_reader :title\n\n    def initialize(title:)\n      @title = title\n    end\nend\n\ntodo = Todo.new('My To-do')\nevent = TodoCreatedEvent.new(todo)\ndispatcher.dispatch(TodoCreatedEvent::NAME, event)\n\n# STDOUT: created a new to-do with title: 'My To-do'\n```\n\n## LICENSE\n\nLicensed under [GNU LGPLv3](https://github.com/dcsg/eventception/blob/master/LICENSE)\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create new Pull Request\n\n## Contributors\n\n * [Daniel Gomes](https://github.com/dcsg)\n * [Ivo Anjo](https://github.com/ivoanjo)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcsg%2Feventception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcsg%2Feventception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcsg%2Feventception/lists"}