annotate .svn/pristine/5f/5f8859116475dd06123c2a90756b26148236e7e2.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 # The PluginList class is an array, enhanced to allow access to loaded plugins
Chris@909 2 # by name, and iteration over loaded plugins in order of priority. This array is used
Chris@909 3 # by Engines::RailsExtensions::RailsInitializer to create the Engines.plugins array.
Chris@909 4 #
Chris@909 5 # Each loaded plugin has a corresponding Plugin instance within this array, and
Chris@909 6 # the order the plugins were loaded is reflected in the entries in this array.
Chris@909 7 #
Chris@909 8 # For more information, see the Rails module.
Chris@909 9 module Engines
Chris@909 10 class Plugin
Chris@909 11 class List < Array
Chris@909 12 # Finds plugins with the set with the given name (accepts Strings or Symbols), or
Chris@909 13 # index. So, Engines.plugins[0] returns the first-loaded Plugin, and Engines.plugins[:engines]
Chris@909 14 # returns the Plugin instance for the engines plugin itself.
Chris@909 15 def [](name_or_index)
Chris@909 16 if name_or_index.is_a?(Fixnum)
Chris@909 17 super
Chris@909 18 else
Chris@909 19 self.find { |plugin| plugin.name.to_s == name_or_index.to_s }
Chris@909 20 end
Chris@909 21 end
Chris@909 22
Chris@909 23 # Go through each plugin, highest priority first (last loaded first). Effectively,
Chris@909 24 # this is like <tt>Engines.plugins.reverse</tt>
Chris@909 25 def by_precedence
Chris@909 26 reverse
Chris@909 27 end
Chris@909 28 end
Chris@909 29 end
Chris@909 30 end