]> gitweb.michael.orlitzky.com - mailshears.git/blob - src/plugin.rb
Generalize the plugin mechanism with a Plugin module that knows when it's included.
[mailshears.git] / src / plugin.rb
1 # All plugins should include this module. It defines the basic
2 # operations that all plugins are supposed to support.
3 module Plugin
4
5 def Plugin.included(c)
6 # Callback, called whenever another class or module includes this
7 # one. The parameter given is the name of the class or module
8 # that included us.
9 @includers ||= []
10 @includers << c
11 end
12
13 def Plugin.includers
14 return @includers
15 end
16
17 def describe_domain(domain)
18 # Provide a "description" of the domain. This is output along
19 # with the domain name and can be anything of use to the system
20 # administrator.
21 raise NotImplementedError
22 end
23
24 def describe_account(account)
25 # Provide a "description" of the account. This is output along
26 # with the domain name and can be anything of use to the system
27 # administrator.
28 raise NotImplementedError
29 end
30
31 def delete_domain(domain)
32 # Delete the given domain.
33 raise NotImplementedError
34 end
35
36 def delete_account(account)
37 # Delete the given account.
38 raise NotImplementedError
39 end
40
41 def get_leftover_domains(db_domains)
42 # Given a list of domains, determine which domains belonging to this plugin
43 # are not contained in the given list.
44 raise NotImplementedError
45 end
46
47 def get_leftover_accounts(db_accounts)
48 # Given a list of accounts, determine which accounts belonging to this plugin
49 # are not contained in the given list.
50 raise NotImplementedError
51 end
52 end