Class: Moist::MailerRegistry

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

Instance Method Summary collapse

Constructor Details

#initializeMailerRegistry

Returns a new instance of MailerRegistry.



3
4
5
# File 'lib/moist/mailer_registry.rb', line 3

def initialize
  @table = Hash.new
end

Instance Method Details

#[](val) ⇒ Object



12
13
14
# File 'lib/moist/mailer_registry.rb', line 12

def [](val)
  @table[val]
end

#enabled?(klass, action) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/moist/mailer_registry.rb', line 16

def enabled?(klass, action)
  @table[klass] && @table[klass].include?(action)
end

#register(mailer, action) ⇒ Object



7
8
9
10
# File 'lib/moist/mailer_registry.rb', line 7

def register(mailer, action)
  @table[mailer] ||= Set.new
  @table[mailer] << action.to_s
end