Class: AwesomePrint::Formatters::ArrayFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- AwesomePrint::Formatters::ArrayFormatter
- Defined in:
- lib/awesome_print/formatters/array_formatter.rb
Constant Summary
Constants inherited from BaseFormatter
BaseFormatter::DEFAULT_LIMIT_SIZE
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#inspector ⇒ Object
readonly
Returns the value of attribute inspector.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(array, inspector) ⇒ ArrayFormatter
constructor
A new instance of ArrayFormatter.
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(array, inspector) ⇒ ArrayFormatter
Returns a new instance of ArrayFormatter.
8 9 10 11 12 |
# File 'lib/awesome_print/formatters/array_formatter.rb', line 8 def initialize(array, inspector) @array = array @inspector = inspector @options = inspector. end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
6 7 8 |
# File 'lib/awesome_print/formatters/array_formatter.rb', line 6 def array @array end |
#inspector ⇒ Object (readonly)
Returns the value of attribute inspector.
6 7 8 |
# File 'lib/awesome_print/formatters/array_formatter.rb', line 6 def inspector @inspector end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/awesome_print/formatters/array_formatter.rb', line 6 def @options end |
Instance Method Details
#format ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/awesome_print/formatters/array_formatter.rb', line 14 def format if array.length.zero? '[]' elsif methods_array? methods_array else simple_array end end |