lib/activity_engine.rb in activity_engine-0.0.5 vs lib/activity_engine.rb in activity_engine-0.0.6
- old
+ new
@@ -1,12 +1,18 @@
-require "activity_engine/engine"
-require 'activity_engine/context_builder'
-require 'activity_engine/activity_builder'
-
+require 'activity_engine/engine'
module ActivityEngine
module_function
+ def register_models(*models)
+ ActivitySweeper.observe(*models)
+ end
- def register(class_name, method_name, activity_receiver = ActivityEngine::Activity, &config_block)
+ def register_controller(controller_name, actions)
+ controller_name.constantize.module_exec(actions) do
+ cache_sweeper ActivitySweeper, only: actions
+ end
+ end
+
+ def register(class_name, method_name, activity_receiver = Activity, &config_block)
context_builder = ContextBuilder.new(class_name, method_name)
activity_builder = ActivityBuilder.new(activity_receiver, config_block)
context_builder.wrap!(activity_builder)
end