Class: AmazingPrint::Formatters::SimpleFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/amazing_print/formatters/simple_formatter.rb

Constant Summary

Constants inherited from BaseFormatter

BaseFormatter::DEFAULT_LIMIT_SIZE, BaseFormatter::INDENT_CACHE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseFormatter

#align, #get_limit_size, #indent, #indentation, #indented, #limited, #method_tuple, #outdent, #should_be_limited?

Methods included from Colorize

#colorize

Constructor Details

#initialize(string, type, inspector) ⇒ SimpleFormatter

Returns a new instance of SimpleFormatter.



8
9
10
11
12
13
# File 'lib/amazing_print/formatters/simple_formatter.rb', line 8

def initialize(string, type, inspector)
  @string = string
  @type = type
  @inspector = inspector
  @options = inspector.options
end

Instance Attribute Details

#inspectorObject (readonly)

Returns the value of attribute inspector.



6
7
8
# File 'lib/amazing_print/formatters/simple_formatter.rb', line 6

def inspector
  @inspector
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/amazing_print/formatters/simple_formatter.rb', line 6

def options
  @options
end

#stringObject (readonly)

Returns the value of attribute string.



6
7
8
# File 'lib/amazing_print/formatters/simple_formatter.rb', line 6

def string
  @string
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/amazing_print/formatters/simple_formatter.rb', line 6

def type
  @type
end

Instance Method Details

#formatObject



15
16
17
# File 'lib/amazing_print/formatters/simple_formatter.rb', line 15

def format
  colorize(string, type)
end