Sha256: 7875642b27868fbd34d13800b29ca8e0bd4755ce783f6fe6f3d7e56f14641e0a

Contents?: true

Size: 620 Bytes

Versions: 3

Compression:

Stored size: 620 Bytes

Contents

module TFG
  module Support
    class HashWithIndifferentEquality < BasicObject
      def initialize(hash)
        @hash = hash
      end

      def is_a?(klass)
        if klass == ::TFG::Support::HashWithIndifferentEquality
          return true
        else
          super
        end
      end

      def ==(other)
        if other.is_a?(::Hash)
          @hash.with_indifferent_access == other.with_indifferent_access
        else
          @hash == other
        end
      end

      private

      def method_missing(name, *args, &block)
        @hash.public_send(name, *args, &block)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tfg_support-1.1.1 lib/tfg/support/hash_with_indifferent_equality.rb
tfg_support-1.0.1 lib/tfg/support/hash_with_indifferent_equality.rb
tfg_support-1.0.0 lib/tfg/support/hash_with_indifferent_equality.rb