Sha256: df8c5ee6e502eb5bd6736b3b453edadafe9662ce68dcf044fca0125fdb507e4c

Contents?: true

Size: 456 Bytes

Versions: 2

Compression:

Stored size: 456 Bytes

Contents

require 'object_comparator/version'

class ObjectComparator
  def equal?(one, other)
    one = InspectionString.new(one.inspect)
    other = InspectionString.new(other.inspect)
    one == other
  end

  class InspectionString
    def initialize(string)
      @string = string
    end

    def ==(other)
      other.to_s == to_s
    end

    def to_s
      @string.gsub(/:0x[a-z0-9]{14} /, ' ')
             .gsub(/:0x[a-z0-9]{14}>/, '>')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
object_comparator-0.1.1 lib/object_comparator.rb
object_comparator-0.1.0 lib/object_comparator.rb