Sha256: 219a2818c6c7ff7f4d7278c28e2642bedfb1aea212f3ff40f892a2216151a471
Contents?: true
Size: 928 Bytes
Versions: 4
Compression:
Stored size: 928 Bytes
Contents
module Euston module EventHandler extend ActiveSupport::Concern include Euston::EventHandlerPrivateMethodNames included do attr_accessor :log unless public_method_defined? :log= end module ClassMethods def subscribes type, version = 1, opts = {}, &consumer if self.include? Euston::AggregateRoot o = { :id => :id }.merge opts self.class.send :define_method, id_from_event_method_name(type, version) do |event| if o[:id].respond_to? :call o[:id].call event else event[o[:id]] end end end method_name = event_handler_method_name type, version define_method method_name, &consumer new_method = instance_method method_name define_method method_name do |*args| new_method.bind(self).call *args end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
euston-1.2.10 | lib/euston/event_handler.rb |
euston-1.2.10-java | lib/euston/event_handler.rb |
euston-1.2.9-java | lib/euston/event_handler.rb |
euston-1.2.9 | lib/euston/event_handler.rb |