module T::Props::PrettyPrintable::DecoratorMethods

def inspect_instance(instance, multiline: false, indent: ' ')

def inspect_instance(instance, multiline: false, indent: '  ')
  components =
    inspect_instance_components(
      instance,
      multiline: multiline,
      indent: indent
    )
      .reject(&:empty?)
  # Not using #<> here as that makes pry highlight these objects
  # as if they were all comments, whereas this makes them look
  # like the structured thing they are.
  if multiline
    "#{components[0]}:\n" + T.must(components[1..-1]).join("\n")
  else
    "<#{components.join(' ')}>"
  end
end

def inspect_instance_components(instance, multiline:, indent:)

def inspect_instance_components(instance, multiline:, indent:)
_props = T.unsafe(self).all_props.map do |prop|
p, inspect_prop_value(instance, prop, multiline: multiline, indent: indent)]
_props = join_props_with_pretty_values(
ty_props,
iline: multiline,
nt: indent
safe(self).decorated_class.to_s,
ed_props,

def inspect_prop_value(instance, prop, multiline:, indent:)

def inspect_prop_value(instance, prop, multiline:, indent:)
T.unsafe(self).get(instance, prop)
= T.unsafe(self).prop_rules(prop)
stom_inspect = rules[:inspect])
::Utils.arity(custom_inspect) == 1
stom_inspect.call(val)

stom_inspect.call(val, {multiline: multiline, indent: indent})
rules[:sensitivity] && !rules[:sensitivity].empty? && !val.nil?
DACTED #{rules[:sensitivity].join(', ')}>"
inspect

def join_props_with_pretty_values(pretty_kvs, multiline:, indent: ' ')

def join_props_with_pretty_values(pretty_kvs, multiline:, indent: '  ')
= pretty_kvs
t_by {|k, _v| k.to_s}
 {|k, v| "#{k}=#{v}"}
tiline
nt + pairs.join("\n#{indent}")
s.join(', ')

def valid_props

def valid_props
  super + [:inspect]
end