Module: ObjectInspector
- Defined in:
- lib/object_inspector.rb,
lib/object_inspector/version.rb
Overview
:reek:IrresponsibleModule
Defined Under Namespace
Modules: Conversions, InspectBehaviors Classes: BaseFormatter, CombiningFormatter, Configuration, Inspector, InterrogateObject, Scope, TemplatingFormatter
Constant Summary collapse
- VERSION =
The current ObjectInspector gem version.
"1.2.0"
Class Method Summary collapse
-
.clear_error ⇒ nil
Clear #last_error for the current thread/fiber.
-
.configuration ⇒ Object
Accessor for the Configuration object.
- .configure {|configuration| ... } ⇒ Object
-
.last_error ⇒ Exception?
The most recent exception passed to ObjectInspector.record_error on this thread/fiber.
-
.record_error(exception, object: nil) ⇒ Exception
Remember the given exception--which will have caused inspect to fall back to the original
#inspect. -
.reset_configuration ⇒ Object
Reset the current configuration settings memoized by ObjectInspector.configuration.
Class Method Details
.clear_error ⇒ nil
Clear #last_error for the current thread/fiber.
57 58 59 |
# File 'lib/object_inspector.rb', line 57 def self.clear_error Thread.current[LAST_ERROR_THREAD_KEY] = nil end |
.configuration ⇒ Object
Accessor for the Configuration object.
10 11 12 |
# File 'lib/object_inspector.rb', line 10 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
15 16 17 18 19 |
# File 'lib/object_inspector.rb', line 15 def self.configure yield(configuration) configuration end |
.last_error ⇒ Exception?
The most recent exception passed to record_error on this thread/fiber. Cleared by clear_error (including after a successful gem inspect).
50 51 52 |
# File 'lib/object_inspector.rb', line 50 def self.last_error Thread.current[LAST_ERROR_THREAD_KEY] end |
.record_error(exception, object: nil) ⇒ Exception
Remember the given exception--which will have caused inspect to fall back to
the original #inspect. Stored per-thread/fiber so concurrent use does not
clobber it.
Calls ObjectInspector::Configuration#error_handler with exception, object: after
recording.
38 39 40 41 42 43 44 |
# File 'lib/object_inspector.rb', line 38 def self.record_error(exception, object: nil) Thread.current[LAST_ERROR_THREAD_KEY] = exception configuration.error_handler.(exception, object:) exception end |
.reset_configuration ⇒ Object
Reset the current configuration settings memoized by configuration.
23 24 25 |
# File 'lib/object_inspector.rb', line 23 def self.reset_configuration @configuration = Configuration.new end |