Class: Engines::Plugin::List

Inherits:
Array
  • Object
show all
Defined in:
lib/engines/plugin/list.rb

Instance Method Summary collapse

Instance Method Details

#[](name_or_index) ⇒ Object

Finds plugins with the set with the given name (accepts Strings or Symbols), or index. So, Engines.plugins returns the first-loaded Plugin, and Engines.plugins returns the Plugin instance for the engines plugin itself.



15
16
17
18
19
20
21
# File 'lib/engines/plugin/list.rb', line 15

def [](name_or_index)
  if name_or_index.is_a?(Fixnum)
    super
  else
    self.find { |plugin| plugin.name.to_s == name_or_index.to_s }
  end
end

#by_precedenceObject

Go through each plugin, highest priority first (last loaded first). Effectively, this is like Engines.plugins.reverse



25
26
27
# File 'lib/engines/plugin/list.rb', line 25

def by_precedence
  reverse
end