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
|
||||
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
|
||||
def minor
|
||||
to_a[1].to_s.to_i
|
||||
tokens[1].to_s.to_i
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -184,7 +184,6 @@ class Version
|
||||
def tokens
|
||||
@tokens ||= tokenize
|
||||
end
|
||||
alias_method :to_a, :tokens
|
||||
|
||||
def tokenize
|
||||
@version.scan(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user