Class: ObjectInspector::TemplatingFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- ObjectInspector::TemplatingFormatter
- Defined in:
- lib/object_inspector/formatters/templating_formatter.rb
Overview
ObjectInspector::TemplatingFormatter specializes on BaseFormatter to return the standard/default inspect output format via String templates.
Instance Attribute Summary
Attributes inherited from BaseFormatter
Class Method Summary collapse
-
.templates ⇒ Object
Named String templates.
Instance Method Summary collapse
-
#call ⇒ String
Perform the formatting routine.
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
.templates ⇒ Object
Named String templates. Used by the build_* methods, these templates determine the format of the built output Strings.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 15 def self.templates @templates ||= { base: "<%s>", name: "<%s :: %s>", issues_and_name: "<%s !!%s!! :: %s>", flags_and_name: "<%s(%s) :: %s>", info_and_name: "<%s %s :: %s>", issues_and_info_and_name: "<%s !!%s!! %s :: %s>", flags_and_info: "<%s(%s) %s>", flags_and_issues: "<%s(%s) !!%s!!>", issues_and_info: "<%s !!%s!! %s>", flags_and_issues_and_info: "<%s(%s) !!%s!! %s>", flags_and_issues_and_name: "<%s(%s) !!%s!! :: %s>", flags_and_info_and_name: "<%s(%s) %s :: %s>", flags_and_issues_and_info_and_name: "<%s(%s) !!%s!! %s :: %s>", flags: "<%s(%s)>", issues: "<%s !!%s!!>", info: "<%s %s>", }.freeze end |
Instance Method Details
#call ⇒ String
Perform the formatting routine.
39 40 41 42 43 44 45 |
# File 'lib/object_inspector/formatters/templating_formatter.rb', line 39 def call if wrapped_object_inspection_result build_wrapped_object_string else build_string end end |