Class: Gemi::Gem
- Inherits:
-
Object
- Object
- Gemi::Gem
- Defined in:
- lib/gemi/gem.rb
Defined Under Namespace
Classes: OptionNotSupported
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
-
.from_yaml(yaml) ⇒ Object
Returns an array of Gem.
Instance Method Summary collapse
-
#initialize(name, version = nil, options = {}) ⇒ Gem
constructor
A new instance of Gem.
- #to_command(type) ⇒ Object
Constructor Details
#initialize(name, version = nil, options = {}) ⇒ Gem
Returns a new instance of Gem.
24 25 26 |
# File 'lib/gemi/gem.rb', line 24 def initialize(name, version=nil, ={}) @name, @version, @options = name, version, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/gemi/gem.rb', line 28 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/gemi/gem.rb', line 28 def @options end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
28 29 30 |
# File 'lib/gemi/gem.rb', line 28 def version @version end |
Class Method Details
.from_yaml(yaml) ⇒ Object
Returns an array of Gem
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gemi/gem.rb', line 7 def self.from_yaml(yaml) return [] unless yaml["gems"] yaml["gems"].map{|spec| = { :install => spec["install_options"], :uninstall => spec["uninstall_options"], } %w(update_options clean_options).each do |key| if spec[key] raise OptionNotSupported, "you cannot specify #{key} in YAML file" end end new(spec["name"], spec["version"], ) } end |
Instance Method Details
#to_command(type) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/gemi/gem.rb', line 30 def to_command(type) s = @name s << " -v #{@version}" if @version s << " #{@options[type]}" if @options[type] s end |