Skip to content

Commit

Permalink
Add #original_inspect to ObjectInspectionBehaviors
Browse files Browse the repository at this point in the history
This allows us to maintain access to e.g. Rails' #inspect method via
the #original_inspect alias.
  • Loading branch information
Paul DobbinSchmaltz committed Nov 22, 2024
1 parent 65f08e4 commit 211d9f7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/object_inspection_behaviors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
# the object_inspector gem. Using this approach, we are able to e.g.
# conditionally enable object_inspector throughout the entire app.
module ObjectInspectionBehaviors
unless App.debug? # rubocop:disable Style/IfUnlessModifier
include ObjectInspector::InspectorsHelper
extend ActiveSupport::Concern

included do
alias_method :original_inspect, :inspect

unless App.debug? # rubocop:disable Style/IfUnlessModifier
include ObjectInspector::InspectorsHelper
end
end

def introspect
Expand Down

0 comments on commit 211d9f7

Please sign in to comment.