lib/resque-bus.rb in resque-bus-0.3.1 vs lib/resque-bus.rb in resque-bus-0.3.2
- old
+ new
@@ -150,11 +150,11 @@
def publish_metadata(event_type, attributes={})
# TODO: "bus_app_key" => application.app_key ?
bus_attr = {"bus_published_at" => Time.now.to_i, "bus_event_type" => event_type}
bus_attr["bus_id"] = "#{Time.now.to_i}-#{generate_uuid}"
bus_attr["bus_app_hostname"] = hostname
- bus_attr["bus_locale"] = I18n.locale.to_s if defined?(I18n) && I18n.respond_to?(:locale)
- bus_attr["bus_timezone"] = Time.zone.name if defined?(Time) && Time.respond_to?(:zone)
+ bus_attr["bus_locale"] = I18n.locale.to_s if defined?(I18n) && I18n.respond_to?(:locale) && I18n.locale
+ bus_attr["bus_timezone"] = Time.zone.name if defined?(Time) && Time.respond_to?(:zone) && Time.zone
bus_attr.merge(attributes || {})
end
def generate_uuid
require 'securerandom' unless defined?(SecureRandom)
\ No newline at end of file