Class: Lookout::Inspect
Overview
Non-failing inspection of objects. The inspection is encoded for output.
Class Method Summary collapse
-
.args(*args) ⇒ String
The inspections of ARGS, separated by “, ”’s.
Instance Method Summary collapse
-
#call ⇒ String
(also: #to_s)
An UTF-8-encoded String inspection of the given object, generated by invoking #inspect on it, then encoding it as UTF-8, using #dump if any transcoding that may take place fails.
Class Method Details
Instance Method Details
#call ⇒ String Also known as: to_s
Returns An UTF-8-encoded String inspection of the given object, generated by invoking #inspect on it, then encoding it as UTF-8, using #dump if any transcoding that may take place fails.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/lookout-3.0/inspect.rb', line 23 def call Lookout::Encode.new(inspection = inspect_object).call rescue => e '(cannot encode inspected %s for output: %s; %s)' % [type, Lookout::Exception.new(e), begin 'dumping instead: %s' % [inspection.dump] rescue => inner 'dumping also failed: %s' % Lookout::Exception.new(inner) end] end |