Class: Ore::Dependency
- Inherits:
-
Gem::Dependency
- Object
- Gem::Dependency
- Ore::Dependency
- Defined in:
- lib/ore/dependency.rb
Overview
Represents a RubyGem dependency.
Class Method Summary collapse
-
.parse(dependency) ⇒ Dependency
Parses a dependency string.
-
.parse_versions(name, versions) ⇒ Dependency
Parses a version string.
Instance Method Summary collapse
-
#versions ⇒ Array<String>
The version requirements of the dependency.
Class Method Details
.parse(dependency) ⇒ Dependency
Parses a dependency string.
43 44 45 46 47 |
# File 'lib/ore/dependency.rb', line 43 def self.parse(dependency) name, versions = dependency.strip.split(/\s+/,2) return parse_versions(name,versions) end |
.parse_versions(name, versions) ⇒ Dependency
Parses a version string.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ore/dependency.rb', line 21 def self.parse_versions(name,versions) versions = case versions when String versions.strip.split(/,\s*/) when Array versions.map { |v| v.to_s } else [] end return new(name,*versions) end |
Instance Method Details
#versions ⇒ Array<String>
The version requirements of the dependency.
57 58 59 |
# File 'lib/ore/dependency.rb', line 57 def versions requirements_list.map { |req| req.to_s } end |