lib/dottie/freckle.rb in dottie-0.0.1 vs lib/dottie/freckle.rb in dottie-0.0.2
- old
+ new
@@ -4,10 +4,15 @@
##
# Creates a new Freckle to wrap the supplied object.
def initialize(obj)
- @_wrapped_object = obj
+ case obj
+ when Hash, Array
+ @_wrapped_object = obj
+ else
+ raise TypeError, 'must be a Hash or Array'
+ end
end
##
# Returns the wrapped Hash, and raises an error if the wrapped object is
# not a Hash.