Sha256: 11faa95f3c4d9d37d1bbf9a956f30f9512c4478070f2efd9f4165101303fe7e1

Contents?: true

Size: 341 Bytes

Versions: 1

Compression:

Stored size: 341 Bytes

Contents

require "simple_listener/version"

module SimpleListener
  def add_listener(listener)
    (@listeners ||= []) << listener
  end

  def call_listeners(event_name, *args)
    @listeners && @listeners.each do |listener|
      if listener.respond_to?(event_name)
        listener.public_send(event_name, self, *args)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_listener-1.0.0 lib/simple_listener.rb