Module: Redmine::Activity

Defined in:
lib/redmine/activity.rb,
lib/redmine/activity/fetcher.rb

Defined Under Namespace

Classes: Fetcher

Constant Summary collapse

@@available_event_types =
[]
@@default_event_types =
[]
@@providers =
Hash.new {|h,k| h[k]=[] }

Class Method Summary collapse

Class Method Details

.map {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:


25
26
27
# File 'lib/redmine/activity.rb', line 25

def map(&block)
  yield self
end

.register(event_type, options = {}) ⇒ Object

Registers an activity provider


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/redmine/activity.rb', line 30

def register(event_type, options={})
  options.assert_valid_keys(:class_name, :default)

  event_type = event_type.to_s
  providers = options[:class_name] || event_type.classify
  providers = ([] << providers) unless providers.is_a?(Array)

  @@available_event_types << event_type unless @@available_event_types.include?(event_type)
  @@default_event_types << event_type unless options[:default] == false
  @@providers[event_type] += providers
end