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
Instance Attribute Summary collapse
-
#inspector ⇒ Object
readonly
Returns the value of attribute 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.
-
#issues ⇒ String, NilClass
Delegates to Inspector#issues.
-
#name ⇒ String, NilClass
Delegates to Inspector#name.
-
#wrapped_object_inspection_result ⇒ String, NilClass
Delegates to Inspector#wrapped_object_inspection_result.
Constructor Details
#initialize(inspector) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
11 12 13 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 11 def initialize(inspector) @inspector = inspector end |
Instance Attribute Details
#inspector ⇒ Object (readonly)
Returns the value of attribute 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.
18 19 20 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 18 def call raise NotImplementedError end |
#flags ⇒ String, NilClass
Delegates to Inspector#flags.
42 43 44 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 42 def flags @flags ||= @inspector.flags end |
#identification ⇒ String
Delegates to Inspector#identification.
34 35 36 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 34 def identification @identification ||= @inspector.identification end |
#info ⇒ String, NilClass
Delegates to Inspector#info.
58 59 60 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 58 def info @info ||= @inspector.info end |
#issues ⇒ String, NilClass
Delegates to Inspector#issues.
50 51 52 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 50 def issues @issues ||= @inspector.issues end |
#name ⇒ String, NilClass
Delegates to Inspector#name.
66 67 68 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 66 def name @name ||= @inspector.name end |
#wrapped_object_inspection_result ⇒ String, NilClass
Delegates to Inspector#wrapped_object_inspection_result.
26 27 28 29 |
# File 'lib/object_inspector/formatters/base_formatter.rb', line 26 def wrapped_object_inspection_result @wrapped_object_inspection_result ||= @inspector.wrapped_object_inspection_result end |