Sha256: c10d6e74ceba54b885bdb06872cd1ed21bf0073cd5bcced2635b99e4d9521f2d

Contents?: true

Size: 701 Bytes

Versions: 3

Compression:

Stored size: 701 Bytes

Contents

require 'activity_engine/engine'
module ActivityEngine
  module_function
  def register_models(*models)
    ActivitySweeper.observe(*models)
  end

  def register_controller(controller_name, actions)
    controller_name.constantize.module_exec(actions) do |swept_actions|
      cache_sweeper ActivitySweeper, only: swept_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

  def extract_subject_id(object)
    Array(object.to_key).join(":")
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activity_engine-0.0.9 lib/activity_engine.rb
activity_engine-0.0.8 lib/activity_engine.rb
activity_engine-0.0.7 lib/activity_engine.rb