Project

jace

0.0
The project is in a healthy, maintained state
Gem focused on events for meta-programing
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

= 13.0.1
= 0.80.1
= 0.9.9
= 2.3.20
= 0.14.1
= 1.0.0
= 6.0.3
= 3.11.0
= 3.11.0
= 3.11.1
= 4.7.0
= 0.21.2
= 0.9.27
 Project Readme

Jace

Code Climate Test Coverage Issue Count Gem Version Codacy Badge Inline docs

jace

Yard Documentation

https://www.rubydoc.info/gems/jace/0.1.1

Jace is designed to have a semi event driven development

Using Jace::Registry, event handlers can be registered to events, and when an event is triggered, the block that triggers it is given to Jace, which will triger, around it, the +before+ and +after+ handlers

Installation

  • Install it
  gem install jace
  • Or add Sinclair to your Gemfile and bundle install:
  gem 'jace'
  bundle install jace

Using

Initialize a registry, register event handlers nad trigger events

  class SomeContext
    def do_something(instant)
      puts "doing something #{instant}"
    end
  end

  registry = Jace::Registry.new
  context = SomeContext.new

  registry.register(:the_event) { do_something(:after) }
  registry.register(:the_event, :before) { do_something(:before) }

  registry.trigger(:the_event, context) do
   context.do_something(:middle)
  end

  # puts 'doing something before',
  # puts 'doing something middle',
  # puts 'doing something after'