From ec1963a56748dcca1e91106302547105522648c1 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 7 May 2008 01:50:55 +0200 Subject: revised conventions in rails/plugin.rb --- railties/lib/rails/plugin.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index b45ec7de0e..04f7e37a20 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,14 +1,14 @@ module Rails # The Plugin class should be an object which provides the following methods: # - # * +name+ - used during initialisation to order the plugin (based on name and - # the contents of config.plugins) - # * +valid?+ - returns true if this plugin can be loaded - # * +load_paths+ - each path within the returned array will be added to the $LOAD_PATH - # * +load+ - finally 'load' the plugin. + # * +name+ - Used during initialisation to order the plugin (based on name and + # the contents of config.plugins). + # * +valid?+ - Returns true if this plugin can be loaded. + # * +load_paths+ - Each path within the returned array will be added to the $LOAD_PATH. + # * +load+ - Finally 'load' the plugin. # # These methods are expected by the Rails::Plugin::Locator and Rails::Plugin::Loader classes. - # The default implementation returns the lib directory as its load_paths, + # The default implementation returns the lib directory as its load_paths, # and evaluates init.rb when load is called. # # You can also inspect the about.yml data programmatically: @@ -31,13 +31,13 @@ module Rails File.directory?(directory) && (has_lib_directory? || has_init_file?) end - # Returns a list of paths this plugin wishes to make available in $LOAD_PATH + # Returns a list of paths this plugin wishes to make available in $LOAD_PATH. def load_paths report_nonexistant_or_empty_plugin! unless valid? has_lib_directory? ? [lib_path] : [] end - # Evaluates a plugin's init.rb file + # Evaluates a plugin's init.rb file. def load(initializer) return if loaded? report_nonexistant_or_empty_plugin! unless valid? -- cgit v1.2.3