Class: ObjectInspector::Configuration
- Inherits:
-
Object
- Object
- ObjectInspector::Configuration
- Defined in:
- lib/object_inspector.rb
Overview
ObjectInspector::Configuration stores the default configuration options for the ObjectInspector gem. Modification of attributes is possible at any time, and values will persist for the duration of the running process.
Instance Attribute Summary collapse
-
#default_scope ⇒ Object
Returns the value of attribute default_scope.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#flags_separator ⇒ Object
Returns the value of attribute flags_separator.
-
#formatter_class ⇒ Object
Returns the value of attribute formatter_class.
-
#info_separator ⇒ Object
Returns the value of attribute info_separator.
-
#inspect_method_prefix ⇒ Object
Returns the value of attribute inspect_method_prefix.
-
#issues_separator ⇒ Object
Returns the value of attribute issues_separator.
-
#name_separator ⇒ Object
Returns the value of attribute name_separator.
-
#out_of_scope_placeholder ⇒ Object
Returns the value of attribute out_of_scope_placeholder.
-
#presented_object_separator ⇒ Object
Returns the value of attribute presented_object_separator.
-
#wild_card_scope ⇒ Object
Returns the value of attribute wild_card_scope.
Instance Method Summary collapse
-
#disable ⇒ Object
Disable Object Inspector for the current process and print a status message to
$stdout. - #disabled? ⇒ Boolean
-
#enable ⇒ Object
Enable Object Inspector for the current process and print a status message to
$stdout. - #enabled=(value) ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize(enabled: true, formatter_class: TemplatingFormatter, inspect_method_prefix: "inspect", default_scope: Scope.new(:self), wild_card_scope: "all", out_of_scope_placeholder: "*", presented_object_separator: " #{[0x21E8].pack("U")} ", name_separator: " - ", flags_separator: " / ", issues_separator: " | ", info_separator: " | ", error_handler: ->(exception, object:) {}) ⇒ Configuration
constructor
:reek:LongParameterList, :reek:BooleanParameter.
- #toggle ⇒ Object
Constructor Details
#initialize(enabled: true, formatter_class: TemplatingFormatter, inspect_method_prefix: "inspect", default_scope: Scope.new(:self), wild_card_scope: "all", out_of_scope_placeholder: "*", presented_object_separator: " #{[0x21E8].pack("U")} ", name_separator: " - ", flags_separator: " / ", issues_separator: " | ", info_separator: " | ", error_handler: ->(exception, object:) {}) ⇒ Configuration
:reek:LongParameterList, :reek:BooleanParameter
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/object_inspector.rb', line 80 def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists enabled: true, formatter_class: TemplatingFormatter, inspect_method_prefix: "inspect", default_scope: Scope.new(:self), wild_card_scope: "all", out_of_scope_placeholder: "*", presented_object_separator: " #{[0x21E8].pack("U")} ", # This is: " ⇨ " name_separator: " - ", flags_separator: " / ", issues_separator: " | ", info_separator: " | ", error_handler: ->(exception, object:) {} ) @enabled = enabled @formatter_class = formatter_class @inspect_method_prefix = inspect_method_prefix @default_scope = default_scope @wild_card_scope = wild_card_scope @out_of_scope_placeholder = out_of_scope_placeholder @presented_object_separator = presented_object_separator @name_separator = name_separator @flags_separator = flags_separator @issues_separator = issues_separator @info_separator = info_separator self.error_handler = error_handler end |
Instance Attribute Details
#default_scope ⇒ Object
Returns the value of attribute default_scope.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def default_scope @default_scope end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def error_handler @error_handler end |
#flags_separator ⇒ Object
Returns the value of attribute flags_separator.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def flags_separator @flags_separator end |
#formatter_class ⇒ Object
Returns the value of attribute formatter_class.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def formatter_class @formatter_class end |
#info_separator ⇒ Object
Returns the value of attribute info_separator.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def info_separator @info_separator end |
#inspect_method_prefix ⇒ Object
Returns the value of attribute inspect_method_prefix.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def inspect_method_prefix @inspect_method_prefix end |
#issues_separator ⇒ Object
Returns the value of attribute issues_separator.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def issues_separator @issues_separator end |
#name_separator ⇒ Object
Returns the value of attribute name_separator.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def name_separator @name_separator end |
#out_of_scope_placeholder ⇒ Object
Returns the value of attribute out_of_scope_placeholder.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def out_of_scope_placeholder @out_of_scope_placeholder end |
#presented_object_separator ⇒ Object
Returns the value of attribute presented_object_separator.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def presented_object_separator @presented_object_separator end |
#wild_card_scope ⇒ Object
Returns the value of attribute wild_card_scope.
67 68 69 |
# File 'lib/object_inspector.rb', line 67 def wild_card_scope @wild_card_scope end |
Instance Method Details
#disable ⇒ Object
Disable Object Inspector for the current process and print a status
message to $stdout.
131 132 133 134 |
# File 'lib/object_inspector.rb', line 131 def disable self.enabled = false puts(" -> ObjectInspector disabled") end |
#disabled? ⇒ Boolean
127 |
# File 'lib/object_inspector.rb', line 127 def disabled? = !enabled? |
#enable ⇒ Object
Enable Object Inspector for the current process and print a status
message to $stdout.
121 122 123 124 |
# File 'lib/object_inspector.rb', line 121 def enable self.enabled = true puts(" -> ObjectInspector enabled") end |
#enabled=(value) ⇒ Object
109 110 111 |
# File 'lib/object_inspector.rb', line 109 def enabled=(value) @enabled = !!value end |
#enabled? ⇒ Boolean
117 |
# File 'lib/object_inspector.rb', line 117 def enabled? = @enabled |