U Observers Versions Save

Simple and powerful implementation of the observer pattern.

v2.3.0

3 years ago

Feature

  • Allow defining observers using blocks #12

v2.2.0

3 years ago

Features

  • Add new option perform_once: true into observers.attach() to define an observer that will execute only once. #8
  • Add new method observers.once() to define callables that will execute only once. #8
  • Add new method observers.off() to remove observers' objects or to remove callables by their event names. #8

Improvement

  • Allow defining multiple callables to the same event when their values are different. #9

v2.0.0

3 years ago
  • Added Micro::Observers::Event
  • Pass Micro::Observers::Event when the observer's method receives two arguments.
  • Pass Micro::Observers::Event to the callable observers.
  • Allow sending additional data when notifying the observers. e.g. notify(:event, data: :something), call(data: :something)