Module: Elixir::Version
- Defined in:
- lib/elixir/version.rb
Class Method Summary collapse
- .compare(version1, version2) ⇒ Object
- .match?(version, requirement) ⇒ Boolean
- .parse(version) ⇒ Object
- .parse_requirements(string) ⇒ Object
Class Method Details
.compare(version1, version2) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/elixir/version.rb', line 7 def compare version1, version2 case Gem::Version.new(version1) <=> Gem::Version.new(version2) when 1 :gt when 0 :eq when -1 :lt end end |
.match?(version, requirement) ⇒ Boolean
18 19 20 |
# File 'lib/elixir/version.rb', line 18 def match? version, requirement Gem::Dependency.new('', requirement).match? '', version end |
.parse(version) ⇒ Object
22 23 24 25 26 |
# File 'lib/elixir/version.rb', line 22 def parse version [:ok, Gem::Version.new(version)] rescue :error end |
.parse_requirements(string) ⇒ Object
28 29 30 31 32 |
# File 'lib/elixir/version.rb', line 28 def parse_requirements string [:ok, Gem::Requirement.new(string)] rescue :error end |