lib/intercom/shallow_hash.rb in intercom-0.0.3 vs lib/intercom/shallow_hash.rb in intercom-0.0.4
- old
+ new
@@ -1,6 +1,7 @@
module Intercom
- class ShallowHash < Hash #:nodoc:
+ # Sub-class of {Hash} which doesn't allow {Array} or {Hash} values.
+ class ShallowHash < Hash
def []=(key, value)
raise ArgumentError.new("custom_data does not support nested data structures (key: #{key}, value: #{value}") if value.is_a?(Array) || value.is_a?(Hash)
super(key, value)
end
end