Module: SimpleInspect

Overview

Limit output of agent variable

Instance Method Summary collapse

Instance Method Details

#exclude_inspectionObject



19
20
21
# File 'lib/itch/simple_inspect.rb', line 19

def exclude_inspection
  [:agent]
end

#inspectObject



5
6
7
8
9
10
11
12
13
# File 'lib/itch/simple_inspect.rb', line 5

def inspect
  attrs = pretty_print_instance_variables
  values = [
    "#{self.class}##{object_id}",
    *attrs.map { |k| "#{k}: #{instance_variable_get(k)}" }
  ]

  "<#{values.join(" ")}>"
end

#pretty_print_instance_variablesObject



15
16
17
# File 'lib/itch/simple_inspect.rb', line 15

def pretty_print_instance_variables
  instance_variables.sort.reject { |i| exclude_inspection.include? i }
end