lib/protonbot/bot_plugins.rb in protonbot-0.3.3 vs lib/protonbot/bot_plugins.rb in protonbot-0.3.4

- old
+ new

@@ -29,10 +29,11 @@ end # Basically clears plugin hash # @return [Bot] self def plugins_unload + @parr = [] @plugins = {} self end # Loads all plugins by calling `@plugin_loader` and initializing @@ -99,9 +100,23 @@ end else raise ArgumentError, "No such gem: #{gemname}" end self + end + + # Loads plugins by array of strings. If first char of item is period, + # then plugin is loaded from gem + # @param plugins [Array<String>] + # @return [Bot] self + def plugin_array(arr) + arr.each do |pl| + if pl[0] == '.' + gem pl[1,pl.length-1] + else + plugin pl + end + end end # Loads plugin by path # @param path [String] Path # @return [Plugin] Loaded plugin