pkg_version: delegate major, minor, patch methods to :version
This commit is contained in:
parent
266a944bb5
commit
51bc9ae3d9
@ -4,11 +4,20 @@ require "version"
|
||||
|
||||
class PkgVersion
|
||||
include Comparable
|
||||
extend Forwardable
|
||||
|
||||
RX = /\A(.+?)(?:_(\d+))?\z/.freeze
|
||||
|
||||
attr_reader :version, :revision
|
||||
|
||||
delegate [
|
||||
:major,
|
||||
:minor,
|
||||
:patch,
|
||||
:major_minor,
|
||||
:major_minor_patch,
|
||||
] => :version
|
||||
|
||||
def self.parse(path)
|
||||
_, version, revision = *path.match(RX)
|
||||
version = Version.create(version)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user