Class: AmazingPrint::Formatters::MethodFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/amazing_print/formatters/method_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(method, inspector) ⇒ MethodFormatter

Returns a new instance of MethodFormatter.


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

def initialize(method, inspector)
  @method = method
  @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/method_formatter.rb', line 6

def inspector
  @inspector
end

#methodObject (readonly)

Returns the value of attribute method


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

def method
  @method
end

#optionsObject (readonly)

Returns the value of attribute options


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

def options
  @options
end

Instance Method Details

#formatObject


14
15
16
17
18
# File 'lib/amazing_print/formatters/method_formatter.rb', line 14

def format
  name, args, owner = method_tuple(method)

  "#{colorize(owner, :class)}##{colorize(name, :method)}#{colorize(args, :args)}"
end