lib/reactor/event.rb in reactor-0.19.0 vs lib/reactor/event.rb in reactor-1.0.0
- old
+ new
@@ -61,12 +61,15 @@
def publish(name, data = {})
if defined?(Rails::Console) && ENV['RACK_ENV'] == 'production' && data[:srsly].blank?
raise ArgumentError.new(CONSOLE_CONFIRMATION_MESSAGE)
end
+
message = new(data.merge(event: name, uuid: SecureRandom.uuid))
+ Reactor.validator.call(message)
+
if message.at
perform_at message.at, name, message.__data__
else
perform_async name, message.__data__
end
@@ -122,8 +125,10 @@
def initialize_polymorphic_association(method)
__data__["#{method}_type"].constantize.find(__data__["#{method}_id"])
end
def fire_block_subscribers(data, name)
- ((Reactor::SUBSCRIBERS[name.to_s] || []) | (Reactor::SUBSCRIBERS['*'] || [])).each { |s| s.perform_where_needed(data) }
+ ((Reactor::SUBSCRIBERS[name.to_s] || []) | (Reactor::SUBSCRIBERS['*'] || [])).each do |s|
+ s.perform_where_needed(data)
+ end
end
end