Module: Redmine::Activity

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

Overview

Since:

  • 0.8.0

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

.delete(event_type) ⇒ Object

Since:

  • 3.0.0



45
46
47
48
49
# File 'lib/redmine/activity.rb', line 45

def delete(event_type)
  @@available_event_types.delete event_type
  @@default_event_types.delete event_type
  @@providers.delete(event_type)
end

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

Yields:

  • (_self)

Yield Parameters:



28
29
30
# File 'lib/redmine/activity.rb', line 28

def map(&block)
  yield self
end

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

Registers an activity provider



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/redmine/activity.rb', line 33

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