lib/ownership.rb in ownership-0.2.0 vs lib/ownership.rb in ownership-0.3.0
- old
+ new
@@ -1,14 +1,16 @@
-require "ownership/global_methods"
-require "ownership/honeybadger"
-require "ownership/rollbar"
-require "ownership/version"
+# modules
+require_relative "ownership/global_methods"
+require_relative "ownership/version"
+# integrations
+require_relative "ownership/honeybadger"
+require_relative "ownership/rollbar"
+
module Ownership
class << self
- attr_accessor :default_owner
- attr_accessor :around_change
+ attr_accessor :around_change, :default_owner
def owner
Thread.current[:ownership_owner] || default_owner
end
end
@@ -16,27 +18,27 @@
Object.include Ownership::GlobalMethods
if defined?(ActiveSupport)
ActiveSupport.on_load(:action_controller) do
- require "ownership/controller_methods"
+ require_relative "ownership/controller_methods"
include Ownership::ControllerMethods
end
ActiveSupport.on_load(:active_record) do
if ActiveRecord::VERSION::MAJOR >= 7
ActiveRecord::QueryLogs.taggings[:owner] ||= -> { Ownership.owner }
end
- require "ownership/marginalia" if defined?(Marginalia)
+ require_relative "ownership/marginalia" if defined?(Marginalia)
end
ActiveSupport.on_load(:active_job) do
- require "ownership/job_methods"
+ require_relative "ownership/job_methods"
include Ownership::JobMethods
end
else
- require "ownership/marginalia" if defined?(Marginalia)
+ require_relative "ownership/marginalia" if defined?(Marginalia)
end
class Exception
attr_accessor :owner
end