lib/hash_ish.rb in hash_ish-0.1.0 vs lib/hash_ish.rb in hash_ish-0.2.0
- old
+ new
@@ -2,18 +2,22 @@
require 'hash_ish/add_instance_methods'
class HashIsh
def self.new(kwargs = {})
instance(
- decorate_klass(kwargs))
+ decorate_klass(hash_sub_class, kwargs))
end
+ def self.decorate_klass(klass, kwargs)
+ klass.tap do |klass|
+ AddInstanceMethods.new.add(klass, kwargs)
+ end
+ end
+
def self.instance(klass)
klass.new
end
- def self.decorate_klass(kwargs)
- Class.new.tap do |klass|
- AddInstanceMethods.new.add(klass, kwargs)
- end
+ def self.hash_sub_class
+ Class.new(Hash)
end
end