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.

Instance Attribute Summary

Attributes inherited from BaseFormatter

#inspector

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseFormatter

#flags, #identification, #info, #initialize, #issues, #name, #wrapped_object_inspection_result

Constructor Details

This class inherits a constructor from ObjectInspector::BaseFormatter

Class Method Details

.base_templateObject



10
11
12
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 10

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

.flags_and_info_and_name_templateObject



54
55
56
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 54

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

.flags_and_info_templateObject



34
35
36
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 34

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

.flags_and_issues_and_info_and_name_templateObject



58
59
60
61
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 58

def self.flags_and_issues_and_info_and_name_template
  @flags_and_issues_and_info_and_name_template ||=
    "<%s(%s) !!%s!! %s :: %s>"
end

.flags_and_issues_and_info_templateObject



46
47
48
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 46

def self.flags_and_issues_and_info_template
  @flags_and_issues_and_info_template ||= "<%s(%s) !!%s!! %s>"
end

.flags_and_issues_and_name_templateObject



50
51
52
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 50

def self.flags_and_issues_and_name_template
  @flags_and_issues_and_name_template ||= "<%s(%s) !!%s!! :: %s>"
end

.flags_and_issues_templateObject



38
39
40
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 38

def self.flags_and_issues_template
  @flags_and_issues_template ||= "<%s(%s) !!%s!!>"
end

.flags_and_name_templateObject



22
23
24
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 22

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

.flags_templateObject



63
64
65
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 63

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

.info_and_name_templateObject



26
27
28
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 26

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

.info_templateObject



71
72
73
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 71

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

.issues_and_info_and_name_templateObject



30
31
32
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 30

def self.issues_and_info_and_name_template
  @issues_and_info_and_name_template ||= "<%s !!%s!! %s :: %s>"
end

.issues_and_info_templateObject



42
43
44
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 42

def self.issues_and_info_template
  @issues_and_info_template ||= "<%s !!%s!! %s>"
end

.issues_and_name_templateObject



18
19
20
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 18

def self.issues_and_name_template
  @issues_and_name_template ||= "<%s !!%s!! :: %s>"
end

.issues_templateObject



67
68
69
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 67

def self.issues_template
  @issues_template ||= "<%s !!%s!!>"
end

.name_templateObject



14
15
16
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 14

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

Instance Method Details

#callString

Perform the formatting routine.

Returns:

  • (String)


78
79
80
81
82
83
84
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 78

def call
  if wrapped_object_inspection_result
    build_wrapped_object_string
  else
    build_string
  end
end