Sha256: bd0149984c334c608fde7a320d2fc8c4f590ea1d70a439f10f3b56fc5c837131

Contents?: true

Size: 693 Bytes

Versions: 5

Compression:

Stored size: 693 Bytes

Contents

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
        sprintf('0x%08x', object_id * 2)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre8 lib/shoes/common/inspect.rb
shoes-core-4.0.0.pre7 lib/shoes/common/inspect.rb
shoes-core-4.0.0.pre6 lib/shoes/common/inspect.rb
shoes-core-4.0.0.pre5 lib/shoes/common/inspect.rb
shoes-core-4.0.0.pre4 lib/shoes/common/inspect.rb