Sha256: 3f2d9eab305963f99a7aff01942d28fbf8718879969e180b63bfe5defe1dc89f

Contents?: true

Size: 463 Bytes

Versions: 6

Compression:

Stored size: 463 Bytes

Contents

# frozen_string_literal: true

# Limit output of agent variable
module SimpleInspect
  def inspect
    attrs = pretty_print_instance_variables
    values = [
      "#{self.class}##{object_id}",
      *attrs.map { |k| "#{k}: #{instance_variable_get(k)}" }
    ]

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

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

  def exclude_inspection
    [:agent]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
itch_client-0.4.3 lib/itch/simple_inspect.rb
itch_client-0.4.2 lib/itch/simple_inspect.rb
itch_client-0.4.1 lib/itch/simple_inspect.rb
itch_client-0.4.0 lib/itch/simple_inspect.rb
itch_client-0.3.0 lib/itch/simple_inspect.rb
itch_client-0.2.0 lib/itch/simple_inspect.rb