Sha256: d4f2cab92d7e42ab1a424a263642b4635d9f47b10a5b3705523dc1a3843c5522

Contents?: true

Size: 357 Bytes

Versions: 8

Compression:

Stored size: 357 Bytes

Contents

# Type good for configurations

class CleanHash
  class Strict < Indifferent
    def [] key
      _check_key_existance key
      super
    end

    def []= key, value
      _check_key_existance key
      super
    end

    private

    def _check_key_existance key
      raise ArgumentError.new('Key not found: %s' % key) unless key?(key)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
clean-hash-0.5.8 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.6 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.5 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.4 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.3 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.2 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.1 ./lib/clean-hash/types/strict_type.rb
clean-hash-0.5.0 ./lib/clean-hash/types/strict_type.rb