lib/supermodel/scriber.rb in supermodel-0.0.1 vs lib/supermodel/scriber.rb in supermodel-0.0.2
- old
+ new
@@ -26,26 +26,29 @@
rec.class.record(:destroy, rec.id)
end
end
module Model
- def self.extended(base)
+ def self.included(base)
Scriber.klasses << base
+ base.extend ClassMethods
end
-
- def scribe_load(type, data) #:nodoc:
- case type
- when :create then create(data)
- when :destroy then destroy(data)
- when :update then update(data)
- else
- method = "scribe_load_#{type}"
- send(method) if respond_to?(method)
+
+ module ClassMethods
+ def scribe_play(type, data) #:nodoc:
+ case type
+ when :create then create(data)
+ when :destroy then destroy(data)
+ when :update then update(data)
+ else
+ method = "scribe_play_#{type}"
+ send(method) if respond_to?(method)
+ end
end
- end
- def record(type, data)
- ::Scriber.record(self, type, data)
+ def record(type, data)
+ ::Scriber.record(self, type, data)
+ end
end
end
end
end
\ No newline at end of file