module Draco::Events::ClassAttributes

Internal: Adds the observe DSL to the World class.

Public Instance Methods

observe(system, options = {}) click to toggle source

Public: Adds an observer to the World.

system - The system to run when the observer matches. options - The Hash options to pass to the initializer (default: {}).

:component - The component to observe (default: The system's filter).
:on - The actions to observe (default: [:add, :remove]).

Returns nothing.

# File lib/draco/events.rb, line 163
def observe(system, options = {})
  raise Draco::Events::InvalidObserverError if system.filter.empty?

  @observers << Observer.new(system, options)
end