Class: ObjectInspector::BaseFormatter
- Inherits:
-
Object
- Object
- ObjectInspector::BaseFormatter
- Defined in:
- lib/object_inspector/formatters/base_formatter.rb
Overview
ObjectInspector::BaseFormatter is an abstract base class that interfaces with Inspector objects to combine the supplied #identification, #flags, #info, and #name strings into a friendly “inspect” String.
Direct Known Subclasses
Constant Summary collapse
- RIGHT_ARROW_ICON =
[0x21E8].pack("U").freeze
Instance Attribute Summary collapse
-
#inspector ⇒ ObjectInspector::Inspector
The current value of inspector.
Instance Method Summary collapse
-
#call ⇒ String
Perform the formatting routine.
-
#flags ⇒ String, NilClass
Delegates to Inspector#flags.
-
#identification ⇒ String
Delegates to Inspector#identification.
-
#info ⇒ String, NilClass
Delegates to Inspector#info.
-
#initialize(inspector) ⇒ BaseFormatter
constructor
A new instance of BaseFormatter.
-
#name ⇒ String, NilClass
Delegates to Inspector#name.
-
#wrapped_object_inspection ⇒ String, NilClass
Delegates to Inspector#wrapped_object_inspection.
Constructor Details
#initialize(inspector) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
13 14 15 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 13 def initialize(inspector) @inspector = inspector end |
Instance Attribute Details
#inspector ⇒ ObjectInspector::Inspector
Returns the current value of inspector.
8 9 10 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 8 def inspector @inspector end |
Instance Method Details
#call ⇒ String
Perform the formatting routine.
20 21 22 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 20 def call raise NotImplementedError end |
#flags ⇒ String, NilClass
Delegates to Inspector#flags.
43 44 45 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 43 def flags @flags ||= inspector.flags end |
#identification ⇒ String
Delegates to Inspector#identification.
35 36 37 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 35 def identification @identification ||= inspector.identification end |
#info ⇒ String, NilClass
Delegates to Inspector#info.
51 52 53 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 51 def info @info ||= inspector.info end |
#name ⇒ String, NilClass
Delegates to Inspector#name.
59 60 61 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 59 def name @name ||= inspector.name end |
#wrapped_object_inspection ⇒ String, NilClass
Delegates to Inspector#wrapped_object_inspection.
28 29 30 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 28 def wrapped_object_inspection @wrapped_object_inspection ||= inspector.wrapped_object_inspection end |