Class: NotifyOn::BulkConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/notify_on/bulk_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BulkConfig

Returns a new instance of BulkConfig.



6
7
# File 'lib/notify_on/bulk_config.rb', line 6

def initialize(options = {})
end

Class Method Details

.loadObject



9
10
11
# File 'lib/notify_on/bulk_config.rb', line 9

def self.load
  new.load
end

Instance Method Details

#loadObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/notify_on/bulk_config.rb', line 13

def load
  return unless File.exists?(config_file) && config
  config.each do |model_name, notification_name|
    notification_name.each do |name, notify_on_config|
      model_name.classify.constantize.class_eval do
        notify_on (notify_on_config['action'] || notify_on_config['when']),
                  notify_on_config.deep_symbolize_keys
      end
    end
  end
end