Class: ObjectInspector::BaseFormatter
- Inherits:
-
Object
- Object
- ObjectInspector::BaseFormatter
- Defined in:
- lib/object_inspector/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
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.
Constructor Details
#initialize(inspector) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
11 12 13 |
# File 'lib/object_inspector/base_formatter.rb', line 11 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/base_formatter.rb', line 8 def inspector @inspector end |
Instance Method Details
#call ⇒ String
Perform the formatting routine.
18 19 20 |
# File 'lib/object_inspector/base_formatter.rb', line 18 def call raise NotImplementedError end |
#flags ⇒ String, NilClass
Delegates to Inspector#flags.
33 34 35 |
# File 'lib/object_inspector/base_formatter.rb', line 33 def flags @inspector.flags end |
#identification ⇒ String
Delegates to Inspector#identification.
25 26 27 |
# File 'lib/object_inspector/base_formatter.rb', line 25 def identification @inspector.identification end |
#info ⇒ String, NilClass
Delegates to Inspector#info.
41 42 43 |
# File 'lib/object_inspector/base_formatter.rb', line 41 def info @inspector.info end |
#name ⇒ String, NilClass
Delegates to Inspector#name.
49 50 51 |
# File 'lib/object_inspector/base_formatter.rb', line 49 def name @inspector.name end |