mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Xml: Move require outside of #parse_xml
Since we use `REXML::Document` in the type signature for `#parse_xml`, we can encounter an `uninitialized constant Homebrew::Livecheck::Strategy::Xml::REXML` error in strategies like `Sparkle` that use `Xml#parse_xml` internally when the Sorbet runtime is used. Moving the related require outside of the `#parse_xml` method and into the `Xml` strategy proper resolves this issue.
This commit is contained in:
parent
6597ee6fd3
commit
a2e966c186
@ -1,6 +1,8 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rexml/document"
|
||||
|
||||
module Homebrew
|
||||
module Livecheck
|
||||
module Strategy
|
||||
@ -53,8 +55,6 @@ module Homebrew
|
||||
# @return [REXML::Document, nil]
|
||||
sig { params(content: String).returns(T.nilable(REXML::Document)) }
|
||||
def self.parse_xml(content)
|
||||
require "rexml/document"
|
||||
|
||||
parsing_tries = 0
|
||||
begin
|
||||
REXML::Document.new(content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user