Class: GemCache::SemVerParser
- Inherits:
-
Object
- Object
- GemCache::SemVerParser
- Defined in:
- lib/gemcache/parsers/sem_ver_parser.rb
Overview
Creates a list of appropriate gem and dependency versions based on semantic versioning requirements. The latest possible verions will always come first in the list.
Defined Under Namespace
Classes: Constraint
Instance Attribute Summary collapse
-
#available ⇒ Object
readonly
List of appropriate semantic versions, with the latest versions at the front of the list.
Instance Method Summary collapse
-
#initialize(stories, requirements, name) ⇒ SemVerParser
constructor
A new instance of SemVerParser.
Constructor Details
#initialize(stories, requirements, name) ⇒ SemVerParser
Returns a new instance of SemVerParser.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gemcache/parsers/sem_ver_parser.rb', line 22 def initialize(stories, requirements, name) constraints = constrain(requirements) @available = [] stories.each do |s| one_constraint_failed = false constraints.each do |c| unless c.appropriate?(s.version) one_constraint_failed = true break end end @available << s.version unless one_constraint_failed end raise NoAvailableVersionsError.new(name) if @available.blank? end |
Instance Attribute Details
#available ⇒ Object (readonly)
List of appropriate semantic versions, with the latest versions at the front of the list.
20 21 22 |
# File 'lib/gemcache/parsers/sem_ver_parser.rb', line 20 def available @available end |