class ObjectInspector::TemplatingFormatter

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

@attr (see BaseFormatter)

Public Class Methods

base_template() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 10
def self.base_template
  @base_template ||= "<%s>"
end
flags_and_info_and_name_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 63
def self.flags_template
  @flags_template ||= "<%s(%s)>"
end
info_and_name_template() click to toggle source
# 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_template() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 71
def self.info_template
  @info_template ||= "<%s %s>"
end
issues_and_info_and_name_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# 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_template() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 67
def self.issues_template
  @issues_template ||= "<%s !!%s!!>"
end
name_template() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 14
def self.name_template
  @name_template ||= "<%s :: %s>"
end

Public Instance Methods

call() click to toggle source

Perform the formatting routine.

@return [String]

# 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

Private Instance Methods

build_base_string() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 239
def build_base_string
  self.class.base_template % [identification]
end
build_string() click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/object_inspector/formatters/templating_formatter.rb, line 95
def build_string
  if flags
    build_string_with_flags_and_maybe_issues_and_info_and_name
  elsif issues
    build_string_with_issues_and_maybe_info_and_name
  elsif info
    build_string_with_info_and_maybe_name
  elsif name
    build_string_with_name
  else
    build_base_string
  end
end
build_string_with_flags() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 223
def build_string_with_flags
  self.class.flags_template % [identification, flags]
end
build_string_with_flags_and_info() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 203
def build_string_with_flags_and_info
  self.class.flags_and_info_template % [identification, flags, info]
end
build_string_with_flags_and_info_and_maybe_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 158
def build_string_with_flags_and_info_and_maybe_name
  if name
    build_string_with_flags_and_info_and_name
  else
    build_string_with_flags_and_info
  end
end
build_string_with_flags_and_info_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 184
def build_string_with_flags_and_info_and_name
  self.class.flags_and_info_and_name_template %
    [identification, flags, info, name]
end
build_string_with_flags_and_issues() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 199
def build_string_with_flags_and_issues
  self.class.flags_and_issues_template % [identification, flags, issues]
end
build_string_with_flags_and_issues_and_info() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 194
def build_string_with_flags_and_issues_and_info
  self.class.flags_and_issues_and_info_template %
    [identification, flags, issues, info]
end
build_string_with_flags_and_issues_and_info_and_maybe_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 132
def build_string_with_flags_and_issues_and_info_and_maybe_name
  if name
    build_string_with_flags_and_issues_and_info_and_name
  else
    build_string_with_flags_and_issues_and_info
  end
end
build_string_with_flags_and_issues_and_info_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 174
def build_string_with_flags_and_issues_and_info_and_name
  self.class.flags_and_issues_and_info_and_name_template %
    [identification, flags, issues, info, name]
end
build_string_with_flags_and_issues_and_maybe_info_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 122
def build_string_with_flags_and_issues_and_maybe_info_and_name
  if info
    build_string_with_flags_and_issues_and_info_and_maybe_name
  elsif name
    build_string_with_flags_and_issues_and_name
  else
    build_string_with_flags_and_issues
  end
end
build_string_with_flags_and_issues_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 179
def build_string_with_flags_and_issues_and_name
  self.class.flags_and_issues_and_name_template %
    [identification, flags, issues, name]
end
build_string_with_flags_and_maybe_issues_and_info_and_name() click to toggle source

rubocop:enable Metrics/MethodLength

# File lib/object_inspector/formatters/templating_formatter.rb, line 110
def build_string_with_flags_and_maybe_issues_and_info_and_name
  if issues
    build_string_with_flags_and_issues_and_maybe_info_and_name
  elsif info
    build_string_with_flags_and_info_and_maybe_name
  elsif name
    build_string_with_flags_and_name
  else
    build_string_with_flags
  end
end
build_string_with_flags_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 207
def build_string_with_flags_and_name
  self.class.flags_and_name_template % [identification, flags, name]
end
build_string_with_info() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 231
def build_string_with_info
  self.class.info_template % [identification, info]
end
build_string_with_info_and_maybe_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 166
def build_string_with_info_and_maybe_name
  if name
    build_string_with_info_and_name
  else
    build_string_with_info
  end
end
build_string_with_info_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 219
def build_string_with_info_and_name
  self.class.info_and_name_template % [identification, info, name]
end
build_string_with_issues() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 227
def build_string_with_issues
  self.class.issues_template % [identification, issues]
end
build_string_with_issues_and_info() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 211
def build_string_with_issues_and_info
  self.class.issues_and_info_template % [identification, issues, info]
end
build_string_with_issues_and_info_and_maybe_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 150
def build_string_with_issues_and_info_and_maybe_name
  if name
    build_string_with_issues_and_info_and_name
  else
    build_string_with_issues_and_info
  end
end
build_string_with_issues_and_info_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 189
def build_string_with_issues_and_info_and_name
  self.class.issues_and_info_and_name_template %
    [identification, issues, info, name]
end
build_string_with_issues_and_maybe_info_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 140
def build_string_with_issues_and_maybe_info_and_name
  if info
    build_string_with_issues_and_info_and_maybe_name
  elsif name
    build_string_with_issues_and_name
  else
    build_string_with_issues
  end
end
build_string_with_issues_and_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 215
def build_string_with_issues_and_name
  self.class.issues_and_name_template % [identification, issues, name]
end
build_string_with_name() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 235
def build_string_with_name
  self.class.name_template % [identification, name]
end
build_wrapped_object_string() click to toggle source
# File lib/object_inspector/formatters/templating_formatter.rb, line 88
def build_wrapped_object_string
  "#{build_string} "\
  "#{ObjectInspector.configuration.presented_object_separator} "\
  "#{wrapped_object_inspection_result}"
end