Module: Equalizer::InspectMethods Private

Defined in:
lib/equalizer.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance methods for inspect and pretty print output

Instance Method Summary collapse

Instance Method Details

#inspectString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

String representation showing only equalizer attributes

Returns:

  • (String)

    inspect output



140
141
142
143
144
145
# File 'lib/equalizer.rb', line 140

def inspect
  attrs = equalizer_keys
    .map { |key| "@#{key}=#{public_send(key).inspect}" }
    .join(", ")
  Object.instance_method(:to_s).bind_call(self).sub(/>\z/, " #{attrs}>")
end

#pretty_print(q) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Pretty print output using PP's object formatting

Parameters:

  • q (PP)

    pretty printer



151
152
153
# File 'lib/equalizer.rb', line 151

def pretty_print(q)
  q.pp_object(self)
end

#pretty_print_instance_variablesArray<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Instance variables to display in pretty print output

Returns:

  • (Array<Symbol>)

    instance variable names



158
159
160
# File 'lib/equalizer.rb', line 158

def pretty_print_instance_variables
  equalizer_keys.map { |key| :"@#{key}" }
end