Class: AmazingPrint::Formatters::ClassFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- AmazingPrint::Formatters::ClassFormatter
- Defined in:
- lib/amazing_print/formatters/class_formatter.rb
Constant Summary
Constants inherited from BaseFormatter
BaseFormatter::DEFAULT_LIMIT_SIZE, BaseFormatter::INDENT_CACHE
Instance Attribute Summary collapse
-
#inspector ⇒ Object
readonly
Returns the value of attribute inspector.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(klass, inspector) ⇒ ClassFormatter
constructor
A new instance of ClassFormatter.
Methods inherited from BaseFormatter
#align, #get_limit_size, #indent, #indentation, #indented, #limited, #method_tuple, #outdent, #should_be_limited?
Methods included from Colorize
Constructor Details
#initialize(klass, inspector) ⇒ ClassFormatter
Returns a new instance of ClassFormatter.
8 9 10 11 12 |
# File 'lib/amazing_print/formatters/class_formatter.rb', line 8 def initialize(klass, inspector) @klass = klass @inspector = inspector @options = inspector. end |
Instance Attribute Details
#inspector ⇒ Object (readonly)
Returns the value of attribute inspector.
6 7 8 |
# File 'lib/amazing_print/formatters/class_formatter.rb', line 6 def inspector @inspector end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
6 7 8 |
# File 'lib/amazing_print/formatters/class_formatter.rb', line 6 def klass @klass end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/amazing_print/formatters/class_formatter.rb', line 6 def @options end |
Instance Method Details
#format ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/amazing_print/formatters/class_formatter.rb', line 14 def format superclass = klass.superclass if superclass colorize("#{klass.inspect} < #{superclass}", :class) else colorize(klass.inspect, :class) end end |