lib/emittance/event_lookup.rb in emittance-1.1.0 vs lib/emittance/event_lookup.rb in emittance-2.0.0.pre.1

- old
+ new

@@ -6,13 +6,13 @@ ## # For looking up event classes by their identifiers. Can perform a reverse lookup of identifiers by their associated # event class. # module EventLookup - class << self - include Emittance::Helpers::StringHelpers + extend Emittance::Helpers::StringHelpers + class << self # Look up an {Emittance::Event} class by an identifier. Generates an Event class if no such class exists for # that identifier. # # EventLookup.find_event_klass :foo # # => FooEvent @@ -53,11 +53,11 @@ klass end # @param klass [Class] a subclass of {Emittance::Event} you wish to find the identifiers for # @return [Set<Symbol>] a collection of identifiers that can be used to identify that event class - def identifiers_for_klass(klass) + def identifiers_for_klass(klass, _event = nil) Emittance::EventLookup::Registry.identifiers_for_klass(klass) end # Registers an identifier for an Event class. After registering, that identifier can be used to identify those # events. @@ -217,10 +217,10 @@ # Retrieves all identifiers associated with the event class. # # @param event_klass [Class] the class you want the identifiers for # @return [Set<Symbol>] all identifiers that can be used to identify the given event class - def identifiers_for_klass(event_klass) + def identifiers_for_klass(event_klass, _event = nil) lookup_klass_to_identifier_mapping(event_klass) || (create_mapping_for_klass(event_klass) && lookup_klass_to_identifier_mapping(event_klass)) end # Registers the given identifier for the given event class.