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:
parent
d0309c2800
commit
0bb765289e
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue