Sha256: 4ed33fb58ec26804756ad5b584366d4934d5b8d7397ab55ab318dfe808a262c6

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

class Shoes
  module Common
    module Inspect
      def to_s
        "(#{self.class.name}#{to_s_details})"
      end

      # Object hex representation from https://github.com/michaeldv/awesome_print
      # Example:
      #   (Shoes::App:0x01234abc "Hello")
      def inspect
        "(#{self.class.name}:#{hexy_object_id}#{inspect_details})"
      end

      private

      # Additional details to include in the inspect representation.
      def inspect_details
        ''
      end

      # Additional details to include in the to_s representation.
      def to_s_details
        ''
      end

      def hexy_object_id
        format('0x%08x', object_id * 2)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-core-4.0.0.rc1 lib/shoes/common/inspect.rb