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

.delete(event_type) ⇒ Object



47
48
49
50
51
# File 'lib/redmine/activity.rb', line 47

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:



30
31
32
# File 'lib/redmine/activity.rb', line 30

def map(&block)
  yield self
end

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

Registers an activity provider



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

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