Class: CleanHash::Safe
- Defined in:
- lib/clean-hash/types/safe_type.rb
Instance Method Summary collapse
Methods inherited from CleanHash
#[], create_struct, #delete, #initialize, #key, #key?, #method_missing, pollute!, #to_ary, #to_h, #to_json
Constructor Details
This class inherits a constructor from CleanHash
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CleanHash
Instance Method Details
#[]=(key, value) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# 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 |