lib/dirty_hashy.rb in dirty_hashy-0.1.0 vs lib/dirty_hashy.rb in dirty_hashy-0.1.1
- old
+ new
@@ -1,8 +1,19 @@
require "active_support/hash_with_indifferent_access"
require "dirty_hashy/version"
+require "dirty_attributes"
+require "method_map"
class DirtyHashy < HashWithIndifferentAccess
+
+ def self.new(constructor = {}, map_methods = false)
+ super(constructor).tap do |instance|
+ if map_methods
+ instance.extend MethodMap
+ instance.dirty_map!
+ end
+ end
+ end
alias :_regular_writer :regular_writer
def regular_writer(key, value)
original_value = changes.key?(key) ? was(key) : self[key]
if original_value == value
\ No newline at end of file