]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/prune/prune_plugin.rb
Update the version in mailshears.gemspec.
[mailshears.git] / lib / prune / prune_plugin.rb
index 1046f2d0b29c575a8a4ecfc8c51a54f1e609e6ad..df621b8aeb79644874adc091e9c6081219cc0cd6 100644 (file)
@@ -1,34 +1,65 @@
-require 'rm/rm_plugin'
+require 'common/plugin.rb'
 
+# Plugins for pruning users. By "pruning," we mean the removal of
+# leftover non-PostfixAdmin users after the associated user has been
+# removed from the Postfixadmin database.
+#
 module PrunePlugin
-  #
-  # Plugins for the removal of leftover non-PostfixAdmin users,
-  # i.e. after an user has been removed from the PostfixAdmin
-  # database.
-  #
-  include RmPlugin
+
+  # Absorb the subclass run() magic from the Plugin::Run module.
   extend Plugin::Run
 
+  # The runner class associated with pruning plugins.
+  #
+  # @return [Class] the {PruneRunner} class.
+  #
   def self.runner()
     return PruneRunner
   end
 
+
+  # The "dummy" runner class associated with pruning plugins.
+  #
+  # @return [Class] the {PruneDummyRunner} class.
+  #
   def self.dummy_runner
     return PruneDummyRunner
   end
 
-  def get_leftover_domains(db_domains)
-    # Given a list of domains, determine which domains belonging to
-    # this plugin are not contained in the given list.
 
+  # Determine which domains are "left over" for this plugin. A domain
+  # is considered "left over" if it has been removed from Postfixadmin
+  # but not some other plugin.
+  #
+  # The leftovers are determined with respect to the list *db_domains*
+  # of domains that Postfixadmin knows about.
+  #
+  # @param db_domains [Array<Domain>] a list of domains that are present
+  #   in the Postfixadmin database.
+  #
+  # @return [Array<Domain>] a list of domains known to this plugin but
+  #   not to Postfixadmin.
+  #
+  def get_leftover_domains(db_domains)
     # WARNING! Array difference doesn't work for some reason.
     return list_domains().select{ |d| !db_domains.include?(d) }
   end
 
-  def get_leftover_users(db_users)
-    # Given a list of users, determine which users belonging to
-    # this plugin are not contained in the given list.
 
+  # Determine which users are "left over" for this plugin. A user
+  # is considered "left over" if it has been removed from Postfixadmin
+  # but not some other plugin.
+  #
+  # The leftovers are determined with respect to the list *db_users*
+  # of users that Postfixadmin knows about.
+  #
+  # @param db_users [Array<User>] a list of users that are present
+  #   in the Postfixadmin database.
+  #
+  # @return [Array<User>] a list of users known to this plugin but
+  #   not to Postfixadmin.
+  #
+  def get_leftover_users(db_users)
     # WARNING! Array difference doesn't work for some reason.
     return list_users().select{ |u| !db_users.include?(u) }
   end