Remove Version#to_a alias
Exposing this as "to_a" was a mistake, versions are not arrays and it causes incorrect behavior when splatted or using Kernel#Array(). Use the more correct name "tokens" instead.
This commit is contained in:
parent
ca10e5005a
commit
113125d394
@ -24,10 +24,10 @@ class PythonInstalled < Requirement
|
|||||||
|
|
||||||
class PythonVersion < Version
|
class PythonVersion < Version
|
||||||
def major
|
def major
|
||||||
to_a[0].to_s.to_i # Python's major.minor are always ints.
|
tokens[0].to_s.to_i # Python's major.minor are always ints.
|
||||||
end
|
end
|
||||||
def minor
|
def minor
|
||||||
to_a[1].to_s.to_i
|
tokens[1].to_s.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,6 @@ class Version
|
|||||||
def tokens
|
def tokens
|
||||||
@tokens ||= tokenize
|
@tokens ||= tokenize
|
||||||
end
|
end
|
||||||
alias_method :to_a, :tokens
|
|
||||||
|
|
||||||
def tokenize
|
def tokenize
|
||||||
@version.scan(
|
@version.scan(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user