Fix unnecessary lexical scoping

The registration of these two modules does not need to occur,
lexically, within the PaperTrail module.

The only lexical contents of a module should be methods, constants,
and statements which require that specific lexical scope.
This commit is contained in:
Jared Beck 2016-04-09 00:08:51 -04:00
parent d0309c2800
commit 0bb765289e
3 changed files with 13 additions and 4 deletions

View File

@ -55,6 +55,11 @@ Style/DoubleNegation:
Style/GuardClause:
MinBodyLength: 3
# Use postfix (modifier) conditionals for one-liners, unless doing so would
# exceed 60 characters.
Style/IfUnlessModifier:
MaxLineLength: 60
# The Ruby Style Guide says:
#
# > Use \ instead of + or << to concatenate two string literals at line end.

View File

@ -102,8 +102,10 @@ module PaperTrail
end
end
end
end
if defined?(::ActionController)
::ActiveSupport.on_load(:action_controller) { include PaperTrail::Rails::Controller }
if defined?(::ActionController)
::ActiveSupport.on_load(:action_controller) do
include ::PaperTrail::Rails::Controller
end
end

View File

@ -32,6 +32,8 @@ module PaperTrail
::PaperTrail.whodunnit = user_for_paper_trail if ::PaperTrail.enabled?
end
end
::Sinatra.register PaperTrail::Sinatra if defined?(::Sinatra)
end
if defined?(::Sinatra)
::Sinatra.register(::PaperTrail::Sinatra)
end