lib/reactor/subscription.rb in reactor-0.15.1 vs lib/reactor/subscription.rb in reactor-0.16.0
- old
+ new
@@ -1,9 +1,10 @@
module Reactor
class Subscription
- attr_reader :source, :event_name, :action, :handler_name, :delay, :async, :worker_class
+ attr_reader :source, :event_name, :action, :handler_name, :delay, :async, :worker_class,
+ :deprecated
def self.build_handler_name(event_name, handler_name_option = nil)
if handler_name_option
handler_name_option.to_s.camelize
elsif event_name == '*'
@@ -22,10 +23,11 @@
@event_name = options[:event_name]
@action = options[:action] || block
@delay = options[:delay].to_i
@async = determine_async(options)
+ @deprecated = !!options[:deprecated]
build_worker_class
end
def handler_defined?
namespace.const_defined?(handler_name) &&
@@ -80,19 +82,21 @@
Class.new(Reactor::Workers::EventWorker) do
self.source = subscription.source
self.action = subscription.action
self.async = subscription.async
self.delay = subscription.delay
+ self.deprecated = subscription.deprecated
end
end
def build_mailer_worker
subscription = self
Class.new(Reactor::Workers::MailerWorker) do
self.source = subscription.source
self.action = subscription.action
self.delay = subscription.delay
self.async = subscription.async
+ self.deprecated = subscription.deprecated
end
end
end
end