Sha256: 716af6e6ca33a8f8a86bf03aafd6c3a468ea9b14cb2a9cea41da583e2d3cca24

Contents?: true

Size: 323 Bytes

Versions: 8

Compression:

Stored size: 323 Bytes

Contents

class CleanHash
  class Safe < Indifferent
    def []= key, value
      value = value.to_s if value.is_a?(Symbol)

      unless value.nil? || value.is_a?(Hash) || value.is_a?(Numeric) || value.is_a?(String)
        raise ArgumentError.new('Unsupported safe type: %s' % value.class)
      end

      super
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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