]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/mv/mv_plugin.rb
Document everything with YARD and fix some bugs along the way.
[mailshears.git] / lib / mv / mv_plugin.rb
index 958f6d40f98d0fd3d3cfdb76d24000c6fcd7b844..5a3192356e7b033dbe35cd3c695c45c2fd378e7b 100644 (file)
@@ -1,35 +1,39 @@
-module MvPlugin
-  #
-  # Plugins for moving (renaming) users.
-  #
+require 'common/plugin.rb'
 
-  def MvPlugin.included(c)
-    # Callback, called whenever another class or module includes this
-    # one. The parameter given is the name of the class or module
-    # that included us.
-    @includers ||= []
-    @includers << c
-  end
+# Plugins for moving (renaming) users. Moving domains is not supported.
+#
+module MvPlugin
 
-  def MvPlugin.includers
-    return @includers
-  end
+  # Absorb the subclass run() magic from the Plugin::Run module.
+  extend Plugin::Run
 
-  def runner()
+  # The runner class associated with move plugins.
+  #
+  # @return [Class] the {MvRunner} class.
+  #
+  def self.runner()
     return MvRunner
   end
 
-  def dummy_runner()
+
+  # The "dummy" runner class associated with move plugins.
+  #
+  # @return [Class] the {MvDummyRunner} class.
+  #
+  def self.dummy_runner()
     return MvDummyRunner
   end
 
-  def mv_domain(from, to)
-    # Rename the given domain.
-    raise NotImplementedError
-  end
 
-  def mv_user(from, to)
-    # Rename the given user.
+  # The interface for the "move a user" operation. Subclasses need to
+  # implement this method so that it moves (renames) the user *src* to
+  # the user *dst*.
+  #
+  # @param src [User] the source user to be moved.
+  #
+  # @param dst [User] the destination user to which we'll move *src*.
+  #
+  def mv_user(src, dst)
     raise NotImplementedError
   end