Class: MailyHerald::Initializer

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

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Initializer

Returns a new instance of Initializer


46
47
48
# File 'lib/maily_herald.rb', line 46

def initialize klass
  @klass = klass
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object


50
51
52
53
54
55
56
57
# File 'lib/maily_herald.rb', line 50

def method_missing m, *args, &block
  if %w{list ad_hoc_mailing one_time_mailing periodical_mailing sequence_mailing sequence}.include?(m.to_s)
    options = args.extract_options!
    @klass.send m, *args, options.merge(locked: true), &block
  else
    @klass.send m, *args, &block
  end
end