Class: Cask::URL Private
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Class corresponding to the url
stanza.
Defined Under Namespace
Instance Method Summary collapse
-
#__getobj__ ⇒ Object
private
-
#__setobj__(dsl) ⇒ Object
private
-
#from_block? ⇒ Boolean
private
-
#initialize(uri = nil, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: T.must(caller_locations).fetch(0), dsl: nil, &block) ⇒ void
constructor
private
-
#location ⇒ Homebrew::SourceLocation
private
-
#unversioned?(ignore_major_version: false) ⇒ Boolean
private
Constructor Details
#initialize(uri = nil, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: T.must(caller_locations).fetch(0), dsl: nil, &block) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'cask/url.rb', line 172 def initialize( uri = nil, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: T.must(caller_locations).fetch(0), dsl: nil, &block ) super( if block LazyObject.new do uri2, = *BlockDSL.new(uri, dsl: dsl, &block).call ||= {} DSL.new(uri2, **) end else DSL.new( T.must(uri), verified: verified, using: using, tag: tag, branch: branch, revisions: revisions, revision: revision, trust_cert: trust_cert, cookies: , referer: referer, header: header, user_agent: user_agent, data: data, only_path: only_path, ) end ) @from_block = !block.nil? @caller_location = caller_location end |
Instance Method Details
#__getobj__ ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
222 223 224 |
# File 'cask/url.rb', line 222 def __getobj__ @dsl end |
#__setobj__(dsl) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
226 227 228 |
# File 'cask/url.rb', line 226 def __setobj__(dsl) @dsl = dsl end |
#from_block? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
258 259 260 |
# File 'cask/url.rb', line 258 def from_block? @from_block end |
#location ⇒ Homebrew::SourceLocation
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
231 232 233 |
# File 'cask/url.rb', line 231 def location Homebrew::SourceLocation.new(@caller_location.lineno, raw_url_line&.index("url")) end |
#unversioned?(ignore_major_version: false) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
247 248 249 250 251 252 253 254 255 |
# File 'cask/url.rb', line 247 def unversioned?(ignore_major_version: false) interpolated_url = raw_url_line&.then { |line| line[/url\s+"([^"]+)"/, 1] } return false unless interpolated_url interpolated_url = interpolated_url.gsub(/\#{\s*version\s*\.major\s*}/, "") if ignore_major_version interpolated_url.exclude?('#{') end |