Class: VPM::Plugin
- Inherits:
-
Object
- Object
- VPM::Plugin
- Defined in:
- lib/vpm/plugin.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, type, options = {}) ⇒ Plugin
constructor
A new instance of Plugin.
- #run_command(command) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(name, type, options = {}) ⇒ Plugin
Returns a new instance of Plugin.
9 10 11 12 13 |
# File 'lib/vpm/plugin.rb', line 9 def initialize(name, type, = {}) @name = name @type = type @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/vpm/plugin.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/vpm/plugin.rb', line 7 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/vpm/plugin.rb', line 7 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
3 4 5 |
# File 'lib/vpm/plugin.rb', line 3 def self.from_hash(hash) self.new(hash[:name], hash[:type], hash[:options]) end |
Instance Method Details
#run_command(command) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vpm/plugin.rb', line 15 def run_command(command) result = false plugins = VPM.plugins if command == "install" result = VPM::Commands::Install.run(self) unless plugins.installed?(name) plugins.plugin_installed(self) if result end result end |
#to_hash ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/vpm/plugin.rb', line 32 def to_hash { :name => name, :type => type, :options => } end |