Add upstream JSON generator modules

This commit is contained in:
Douglas Eichelberger 2024-02-09 11:40:35 -08:00
parent 9dcde74e81
commit 1b84c5c8c2
3 changed files with 11 additions and 3 deletions

View File

@ -55,7 +55,7 @@ module Homebrew
github_output = ENV.fetch("GITHUB_OUTPUT")
File.open(github_output, "a") do |f|
f.puts("runners=#{T.unsafe(runners).to_json}")
f.puts("runners=#{runners.to_json}")
f.puts("runners_present=#{runners.present?}")
end
end

View File

@ -118,8 +118,8 @@ class MacOSRequirement < Requirement
def to_json(options)
comp = @comparator.to_s
return T.unsafe({ comp => @version.map(&:to_s) }).to_json(options) if @version.is_a?(Array)
return { comp => @version.map(&:to_s) }.to_json(options) if @version.is_a?(Array)
T.unsafe({ comp => [@version.to_s] }).to_json(options)
{ comp => [@version.to_s] }.to_json(options)
end
end

View File

@ -3,6 +3,14 @@
# This file contains temporary definitions for fixes that have
# been submitted upstream to https://github.com/sorbet/sorbet.
# https://github.com/sorbet/sorbet/pull/7682
class Array
include JSON::Ext::Generator::GeneratorMethods::Array
end
class Hash
include JSON::Ext::Generator::GeneratorMethods::Hash
end
# https://github.com/sorbet/sorbet/pull/7650
class Etc::Group < Struct
sig { returns(Integer) }