MacOSRequirement: add to_json method
This commit is contained in:
parent
37714b5ce1
commit
c34b4c3abd
@ -42,11 +42,11 @@ class MacOSRequirement < Requirement
|
|||||||
versions newer than #{@version.pretty_name} due to an upstream incompatibility.
|
versions newer than #{@version.pretty_name} due to an upstream incompatibility.
|
||||||
EOS
|
EOS
|
||||||
when :cask
|
when :cask
|
||||||
"This cask does not on macOS versions newer than #{@version.pretty_name}."
|
"This cask does not run on macOS versions newer than #{@version.pretty_name}."
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if @version.respond_to?(:to_ary)
|
if @version.respond_to?(:to_ary)
|
||||||
*versions, last = @version.map(:pretty_name)
|
*versions, last = @version.map(&:pretty_name)
|
||||||
return "macOS #{versions.join(", ")} or #{last} is required."
|
return "macOS #{versions.join(", ")} or #{last} is required."
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -59,4 +59,11 @@ class MacOSRequirement < Requirement
|
|||||||
|
|
||||||
"macOS #{@comparator} #{@version}"
|
"macOS #{@comparator} #{@version}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_json(*args)
|
||||||
|
comp = @comparator.to_s
|
||||||
|
return { comp => @version.map(&:to_s) }.to_json(*args) if @version.is_a?(Array)
|
||||||
|
|
||||||
|
{ comp => [@version.to_s] }.to_json(*args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user