Sha256: 14e36995be03d3c8ab9469436d938df634e897014fc0874bc6500ff4c8d97ad2

Contents?: true

Size: 620 Bytes

Versions: 168

Compression:

Stored size: 620 Bytes

Contents

class Object
  # The following helpers provide a level of indirection for running the specs
  # against a Hash implementation that has a different name than Hash.

  # Returns the Hash class.
  unless method_defined?(:hash_class)
    def hash_class
      Hash
    end
  end

  # Returns a new instance of hash_class.
  def new_hash(*args, &block)
    if block
      hash_class.new(&block)
    elsif args.size == 1
      value = args.first
      if value.is_a?(Hash) or value.is_a?(hash_class)
        hash_class[value]
      else
        hash_class.new value
      end
    else
      hash_class[*args]
    end
  end
end

Version data entries

168 entries across 144 versions & 3 rubygems

Version Path
rhodes-5.5.18 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/helpers/hash.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/helpers/hash.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/helpers/hash.rb
mspec-1.9.1 lib/mspec/helpers/hash.rb
mspec-1.9.0 lib/mspec/helpers/hash.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/helpers/hash.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/helpers/hash.rb
mspec-1.8.0 lib/mspec/helpers/hash.rb
mspec-1.7.0 lib/mspec/helpers/hash.rb
mspec-1.6.0 lib/mspec/helpers/hash.rb
mspec-1.5.21 lib/mspec/helpers/hash.rb
mspec-1.5.20 lib/mspec/helpers/hash.rb
mspec-1.5.19 lib/mspec/helpers/hash.rb
mspec-1.5.18 lib/mspec/helpers/hash.rb