class ObjectInspector::CombiningFormatter

ObjectInspector::CombiningFormatter implements {ObjectInspector::BaseFormatter} to return the standard/default inspect output format by combining Strings.

@attr (see BaseFormatter)

Public Instance Methods

call() click to toggle source

Perform the formatting routine.

@return [String]

# File lib/object_inspector/formatters/combining_formatter.rb, line 13
def call
  if wrapped_object_inspection_result
    build_wrapped_object_string
  else
    build_string
  end
end

Private Instance Methods

build_flags_string() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 51
def build_flags_string
  "(#{flags.to_s.upcase})" if flags
end
build_identification_string() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 47
def build_identification_string
  identification.to_s
end
build_info_string() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 55
def build_info_string
  " #{info}" if info
end
build_name_string() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 59
def build_name_string
  " :: #{name}" if name
end
build_string() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 29
def build_string
  "<#{combine_strings}>"
end
build_wrapped_object_string() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 23
def build_wrapped_object_string
  "#{build_string} "\
  "#{ObjectInspector.configuration.presented_object_separator} "\
  "#{wrapped_object_inspection_result}"
end
combine_strings() click to toggle source
# File lib/object_inspector/formatters/combining_formatter.rb, line 33
def combine_strings
  strings.join
end
strings() click to toggle source

Override in subclasses as needed.

# File lib/object_inspector/formatters/combining_formatter.rb, line 38
def strings
  [
    build_identification_string,
    build_flags_string,
    build_info_string,
    build_name_string
  ].compact
end