Class: ObjectInspector::TemplatingFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/object_inspector/formatters/templating_formatter.rb

Overview

ObjectInspector::TemplatingFormatter implements BaseFormatter to return the standard/default inspect output format via String templates.

Constant Summary

Constants inherited from BaseFormatter

BaseFormatter::RIGHT_ARROW_ICON

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseFormatter

#flags, #identification, #info, #initialize, #name, #wrapped_object_inspection

Constructor Details

This class inherits a constructor from ObjectInspector::BaseFormatter

Instance Attribute Details

#inspectorObjectInspector::Inspector

Returns the current value of inspector.

Returns:



7
8
9
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 7

def inspector
  @inspector
end

Class Method Details

.base_templateObject



8
9
10
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 8

def self.base_template
  @base_template ||= "<%s>".freeze
end

.flags_and_info_and_name_templateObject



28
29
30
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 28

def self.flags_and_info_and_name_template
  @flags_and_info_and_name_template ||= "<%s(%s) %s :: %s>".freeze
end

.flags_and_info_templateObject



24
25
26
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 24

def self.flags_and_info_template
  @flags_and_info_template ||= "<%s(%s) %s>".freeze
end

.flags_and_name_templateObject



16
17
18
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 16

def self.flags_and_name_template
  @flags_and_name_template ||= "<%s(%s) :: %s>".freeze
end

.flags_templateObject



32
33
34
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 32

def self.flags_template
  @flags_template ||= "<%s(%s)>".freeze
end

.info_and_name_templateObject



20
21
22
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 20

def self.info_and_name_template
  @info_and_name_template ||= "<%s %s :: %s>".freeze
end

.info_templateObject



36
37
38
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 36

def self.info_template
  @info_template ||= "<%s %s>".freeze
end

.name_templateObject



12
13
14
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 12

def self.name_template
  @name_template ||= "<%s :: %s>".freeze
end

Instance Method Details

#callString

Perform the formatting routine.

Returns:

  • (String)


43
44
45
46
47
48
49
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 43

def call
  if wrapped_object_inspection
    build_wrapped_object_string
  else
    build_string
  end
end