Sha256: 5cb50c7ba8560e3df15099951253decc9e180e73a5cad008dc3286af6ff762e2
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module Vedeu # A class responsible for plugin loading. # class Plugin # @!attribute [r] name # @return [String] attr_reader :name # @!attribute [r] gem # @return [String] attr_reader :gem # @!attribute [r] gem_name # @return [String] attr_reader :gem_name # @!attribute [rw] enabled # @return [Boolean] attr_accessor :enabled alias_method :enabled?, :enabled # Returns a new instance of Vedeu::Plugin. # # @param name [String] The plugin name. # @param gem [Gem::Specification] The RubyGems gem. # @return [Vedeu::Plugin] def initialize(name, gem) @name = name @gem = gem @gem_name = "vedeu_#{name}" @enabled = false end # Load the plugin (require the gem). # # @return [void] def load! begin require gem_name unless enabled? rescue LoadError => error fail Vedeu::VedeuError, "Unable to load plugin #{gem_name} due to #{error}." rescue => error fail Vedeu::VedeuError, "require '#{gem_name}' failed with #{error}." end @enabled = true end end # Plugin end # Vedeu
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.5.12 | lib/vedeu/plugins/plugin.rb |
vedeu-0.5.11 | lib/vedeu/plugins/plugin.rb |