Module: T::Props::PrettyPrintable::DecoratorMethods

Extended by:
Sig
Defined in:
lib/types/props/pretty_printable.rb

Instance Method Summary collapse

Methods included from Sig

sig

Instance Method Details

#inspect_instance(instance, multiline: false, indent: ' ') ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/types/props/pretty_printable.rb', line 30

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

#valid_propsObject



22
23
24
# File 'lib/types/props/pretty_printable.rb', line 22

def valid_props
  super + [:inspect]
end