class Eventifier::NotificationMapping

Public Class Methods

add(key, relation) click to toggle source
# File lib/eventifier/notifier/notification_mapping.rb, line 2
def self.add(key, relation)
  notification_mappings[key] << relation
end
all() click to toggle source
# File lib/eventifier/notifier/notification_mapping.rb, line 10
def self.all
  notification_mappings
end
find(key) click to toggle source
# File lib/eventifier/notifier/notification_mapping.rb, line 6
def self.find(key)
  notification_mappings[key]
end
users_and_relations(event, key, &block) click to toggle source
# File lib/eventifier/notifier/notification_mapping.rb, line 14
def self.users_and_relations(event, key, &block)
  users = Hash.new { |hash, key| hash[key] = [] }

  find(key).each do |relation|
    Eventifier::Relationship.new(event.eventable, relation).users.each do |user|
      users[user] << relation
      users[user].uniq!
    end
  end

  users.each(&block)
end

Private Class Methods

notification_mappings() click to toggle source
# File lib/eventifier/notifier/notification_mapping.rb, line 29
def self.notification_mappings
  @notification_mapppings ||= Hash.new { |hash, key|
    hash[key] = []
  }
end