class CleanHash::Safe

Public Instance Methods

[]=(key, value) click to toggle source
Calls superclass method CleanHash#[]=
# File lib/clean-hash/types/safe_type.rb, line 3
def []= key, value
  value = value.to_s if value.is_a?(Symbol)

  for kind in [NilClass, Hash, Numeric, String, TrueClass, FalseClass]
    return super if value.is_a?(kind)
  end

  raise ArgumentError.new('Unsupported safe type: %s' % value.class)
end