Class: Homebrew::API::FormulaStruct Private

Inherits:
T::Struct
  • Object
show all
Defined in:
api/formula_struct.rb,
sorbet/rbi/dsl/homebrew/api/formula_struct.rbi

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.

Constant Summary collapse

PREDICATES =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

[
  :bottle,
  :deprecate,
  :disable,
  :head,
  :keg_only,
  :no_autobump,
  :pour_bottle,
  :service,
  :service_run,
  :service_name,
  :stable,
].freeze
SKIP_SERIALIZATION =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

[
  # Bottle checksums have special serialization done by the serialize_bottle method
  :bottle_checksums,
].freeze
SPECS =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

[:head, :stable].freeze
DEFAULT_CELLAR =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

:any_skip_relocation is the most common in homebrew/core

:any_skip_relocation
DependsOnArgs =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

T.type_alias do
  T.any(
    # Dependencies
    T.any(
      # Formula name: "foo"
      String,
      # Formula name and dependency type: { "foo" => :build }
      T::Hash[String, Symbol],
    ),
    # Requirements
    T.any(
      # Requirement name: :macos
      Symbol,
      # Requirement name and other info: { macos: :build }
      T::Hash[Symbol, T::Array[T.anything]],
    ),
  )
end
UsesFromMacOSArgs =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

T.type_alias do
  [
    T.any(
      # Formula name: "foo"
      String,
      # Formula name and dependency type: { "foo" => :build }
      # Formula name, dependency type, and version bounds: { "foo" => :build, since: :catalina }
      T::Hash[T.any(String, Symbol), T.any(Symbol, T::Array[Symbol])],
    ),
    # If the first argument is only a name, this argument contains the version bounds: { since: :catalina }
    T::Hash[Symbol, Symbol],
  ]
end

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aliases: [], bottle_checksums: [], bottle_rebuild: 0, caveats: nil, conflicts: [], deprecate_args: {}, desc:, disable_args: {}, head_dependencies: [], head_url_args: ["", {}], head_uses_from_macos: [], homepage:, keg_only_args: [], license:, link_overwrite_paths: [], no_autobump_args: {}, oldnames: [], post_install_defined: true, pour_bottle_args: {}, revision: 0, ruby_source_checksum:, service_args: [], service_name_args: {}, service_run_args: [], service_run_kwargs: {}, stable_dependencies: [], stable_checksum: nil, stable_url_args: ["", {}], stable_uses_from_macos: [], stable_version:, version_scheme: 0, versioned_formulae: []) ⇒ void

Parameters:



# File ''

const :aliases, T::Array[String], default: []
const :bottle_checksums, T::Array[T::Hash[Symbol, T.any(String, Symbol)]], default: []
const :bottle_rebuild, Integer, default: 0
const :caveats, T.nilable(String)
const :conflicts, T::Array[[String, T::Hash[Symbol, String]]], default: []
const :deprecate_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {}
const :desc, String
const :disable_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {}
const :head_dependencies, T::Array[DependsOnArgs], default: []
const :head_url_args, [String, T::Hash[Symbol, T.anything]], default: ["", {}]
const :head_uses_from_macos, T::Array[UsesFromMacOSArgs], default: []
const :homepage, String
const :keg_only_args, T::Array[T.any(String, Symbol)], default: []
const :license, SPDX::LicenseExpression
const :link_overwrite_paths, T::Array[String], default: []
const :no_autobump_args, T::Hash[Symbol, T.any(String, Symbol)], default: {}
const :oldnames, T::Array[String], default: []
const :post_install_defined, T::Boolean, default: true
const :pour_bottle_args, T::Hash[Symbol, Symbol], default: {}
const :revision, Integer, default: 0
const :ruby_source_checksum, String
const :service_args, T::Array[[Symbol, BasicObject]], default: []
const :service_name_args, T::Hash[Symbol, String], default: {}
const :service_run_args, T::Array[Homebrew::Service::RunParam], default: []
const :service_run_kwargs, T::Hash[Symbol, Homebrew::Service::RunParam], default: {}
const :stable_dependencies, T::Array[DependsOnArgs], default: []
const :stable_checksum, T.nilable(String)
const :stable_url_args, [String, T::Hash[Symbol, T.anything]], default: ["", {}]
const :stable_uses_from_macos, T::Array[UsesFromMacOSArgs], default: []
const :stable_version, String
const :version_scheme, Integer, default: 0
const :versioned_formulae, T::Array[String], default: []

Instance Attribute Details

#aliasesArray<String> (readonly)

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.

Changes to this struct must be mirrored in Homebrew::API::Formula.generate_formula_struct_hash

Returns:



# File ''

const :aliases, T::Array[String], default: []

#bottle_checksumsArray<Hash{Symbol => String, Symbol}> (readonly)

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.

Returns the value of prop bottle_checksums.

Returns:



# File ''

const :bottle_checksums, T::Array[T::Hash[Symbol, T.any(String, Symbol)]], default: []

#bottle_rebuildInteger (readonly)

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.

Returns the value of prop bottle_rebuild.

Returns:



# File ''

const :bottle_rebuild, Integer, default: 0

#caveatsString? (readonly)

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.

Returns the value of prop caveats.

Returns:



# File ''

const :caveats, T.nilable(String)

#conflictsArray<Array<(String, Hash{Symbol => String})>> (readonly)

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.

Returns the value of prop conflicts.

Returns:



# File ''

const :conflicts, T::Array[[String, T::Hash[Symbol, String]]], default: []

#deprecate_argsHash{Symbol => String, Symbol, nil} (readonly)

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.

Returns the value of prop deprecate_args.

Returns:



# File ''

const :deprecate_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {}

#descString (readonly)

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.

Returns the value of prop desc.

Returns:



# File ''

const :desc, String

#disable_argsHash{Symbol => String, Symbol, nil} (readonly)

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.

Returns the value of prop disable_args.

Returns:



# File ''

const :disable_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {}

#head_dependenciesArray<DependsOnArgs> (readonly)

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.

Returns the value of prop head_dependencies.

Returns:



# File ''

const :head_dependencies, T::Array[DependsOnArgs], default: []

#head_url_argsArray<(String, Hash{Symbol => T.anything})> (readonly)

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.

Returns the value of prop head_url_args.

Returns:



# File ''

const :head_url_args, [String, T::Hash[Symbol, T.anything]], default: ["", {}]

#head_uses_from_macosArray<UsesFromMacOSArgs> (readonly)

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.

Returns the value of prop head_uses_from_macos.

Returns:



# File ''

const :head_uses_from_macos, T::Array[UsesFromMacOSArgs], default: []

#homepageString (readonly)

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.

Returns the value of prop homepage.

Returns:



# File ''

const :homepage, String

#keg_only_argsArray<String, Symbol> (readonly)

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.

Returns the value of prop keg_only_args.

Returns:



# File ''

const :keg_only_args, T::Array[T.any(String, Symbol)], default: []

#licenseSPDX::LicenseExpression (readonly)

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.

Returns the value of prop license.



# File ''

const :license, SPDX::LicenseExpression

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.

Returns the value of prop link_overwrite_paths.

Returns:



# File ''

const :link_overwrite_paths, T::Array[String], default: []

#no_autobump_argsHash{Symbol => String, Symbol} (readonly)

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.

Returns the value of prop no_autobump_args.

Returns:



# File ''

const :no_autobump_args, T::Hash[Symbol, T.any(String, Symbol)], default: {}

#oldnamesArray<String> (readonly)

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.

Returns the value of prop oldnames.

Returns:



# File ''

const :oldnames, T::Array[String], default: []

#post_install_definedBoolean (readonly)

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.

Returns the value of prop post_install_defined.

Returns:

  • (Boolean)


# File ''

const :post_install_defined, T::Boolean, default: true

#pour_bottle_argsHash{Symbol => Symbol} (readonly)

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.

Returns the value of prop pour_bottle_args.

Returns:



# File ''

const :pour_bottle_args, T::Hash[Symbol, Symbol], default: {}

#revisionInteger (readonly)

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.

Returns the value of prop revision.

Returns:



# File ''

const :revision, Integer, default: 0

#ruby_source_checksumString (readonly)

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.

Returns the value of prop ruby_source_checksum.

Returns:



# File ''

const :ruby_source_checksum, String

#service_argsArray<Array<(Symbol, BasicObject)>> (readonly)

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.

Returns the value of prop service_args.

Returns:



# File ''

const :service_args, T::Array[[Symbol, BasicObject]], default: []

#service_name_argsHash{Symbol => String} (readonly)

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.

Returns the value of prop service_name_args.

Returns:



# File ''

const :service_name_args, T::Hash[Symbol, String], default: {}

#service_run_argsArray<Homebrew::Service::RunParam> (readonly)

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.

Returns the value of prop service_run_args.



# File ''

const :service_run_args, T::Array[Homebrew::Service::RunParam], default: []

#service_run_kwargsHash{Symbol => Homebrew::Service::RunParam} (readonly)

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.

Returns the value of prop service_run_kwargs.



# File ''

const :service_run_kwargs, T::Hash[Symbol, Homebrew::Service::RunParam], default: {}

#stable_checksumString? (readonly)

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.

Returns the value of prop stable_checksum.

Returns:



# File ''

const :stable_checksum, T.nilable(String)

#stable_dependenciesArray<DependsOnArgs> (readonly)

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.

Returns the value of prop stable_dependencies.

Returns:



# File ''

const :stable_dependencies, T::Array[DependsOnArgs], default: []

#stable_url_argsArray<(String, Hash{Symbol => T.anything})> (readonly)

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.

Returns the value of prop stable_url_args.

Returns:



# File ''

const :stable_url_args, [String, T::Hash[Symbol, T.anything]], default: ["", {}]

#stable_uses_from_macosArray<UsesFromMacOSArgs> (readonly)

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.

Returns the value of prop stable_uses_from_macos.

Returns:



# File ''

const :stable_uses_from_macos, T::Array[UsesFromMacOSArgs], default: []

#stable_versionString (readonly)

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.

Returns the value of prop stable_version.

Returns:



# File ''

const :stable_version, String

#version_schemeInteger (readonly)

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.

Returns the value of prop version_scheme.

Returns:



# File ''

const :version_scheme, Integer, default: 0

#versioned_formulaeArray<String> (readonly)

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.

Returns the value of prop versioned_formulae.

Returns:



# File ''

const :versioned_formulae, T::Array[String], default: []

Class Method Details

.deep_compact_blank(obj) ⇒ T.type_parameter(:U)?

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.

Parameters:

  • obj (T.all(T.type_parameter(:U), Object))

Returns:

  • (T.type_parameter(:U), nil)


304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'api/formula_struct.rb', line 304

def self.deep_compact_blank(obj)
  obj = case obj
  when Hash
    obj.transform_values { |v| deep_compact_blank(v) }
       .compact
  when Array
    obj.filter_map { |v| deep_compact_blank(v) }
  else
    obj
  end

  return if obj.blank? || (obj.is_a?(Numeric) && obj.zero?)

  obj
end

.deep_stringify_symbols(obj) ⇒ T.untyped

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.

Parameters:

  • obj (T.untyped)

Returns:

  • (T.untyped)


257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'api/formula_struct.rb', line 257

def self.deep_stringify_symbols(obj)
  case obj
  when String
    # Escape leading : or \ to avoid confusion with stringified symbols
    # ":foo" -> "\:foo"
    # "\foo" -> "\\foo"
    if obj.start_with?(":", "\\")
      "\\#{obj}"
    else
      obj
    end
  when Symbol
    ":#{obj}"
  when Hash
    obj.to_h { |k, v| [deep_stringify_symbols(k), deep_stringify_symbols(v)] }
  when Array
    obj.map { |v| deep_stringify_symbols(v) }
  else
    obj
  end
end

.deep_unstringify_symbols(obj) ⇒ T.untyped

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.

Parameters:

  • obj (T.untyped)

Returns:

  • (T.untyped)


280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'api/formula_struct.rb', line 280

def self.deep_unstringify_symbols(obj)
  case obj
  when String
    if obj.start_with?("\\")
      obj[1..]
    elsif obj.start_with?(":")
      T.must(obj[1..]).to_sym
    else
      obj
    end
  when Hash
    obj.to_h { |k, v| [deep_unstringify_symbols(k), deep_unstringify_symbols(v)] }
  when Array
    obj.map { |v| deep_unstringify_symbols(v) }
  else
    obj
  end
end

.deserialize(hash, bottle_tag: ::Utils::Bottles.tag) ⇒ FormulaStruct

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.

Parameters:

Returns:



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
# File 'api/formula_struct.rb', line 175

def self.deserialize(hash, bottle_tag: ::Utils::Bottles.tag)
  hash = deep_unstringify_symbols(hash)

  # Items that don't follow the `hash["foo_present"] = hash["foo_args"].present?` pattern are overridden below
  PREDICATES.each do |name|
    hash["#{name}_present"] = hash["#{name}_args"].present?
  end

  if (bottle_checksum = hash["bottle_checksum"])
    tag = hash.fetch("bottle_tag", bottle_tag.to_sym)
    cellar = hash.fetch("bottle_cellar", DEFAULT_CELLAR)

    hash["bottle_present"] = true
    hash["bottle_checksums"] = [{ cellar: cellar, tag => bottle_checksum }]
  else
    hash["bottle_present"] = false
  end

  # *_url_args need to be in [String, Hash] format, but the hash may have been dropped if empty
  SPECS.each do |key|
    if (url_args = hash["#{key}_url_args"])
      hash["#{key}_present"] = true
      hash["#{key}_url_args"] = format_arg_pair(url_args, last: {})
    else
      hash["#{key}_present"] = false
    end

    next unless (uses_from_macos = hash["#{key}_uses_from_macos"])

    hash["#{key}_uses_from_macos"] = uses_from_macos.map do |args|
      format_arg_pair(args, last: {})
    end
  end

  hash["service_args"] = if (service_args = hash["service_args"])
    service_args.map { |service_arg| format_arg_pair(service_arg, last: nil) }
  end

  hash["conflicts"] = if (conflicts = hash["conflicts"])
    conflicts.map { |conflict| format_arg_pair(conflict, last: {}) }
  end

  from_hash(hash)
end

.format_arg_pair(args, last:) ⇒ Array<(T.type_parameter(:U), T.type_parameter(:V))>

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.

Format argument pairs into proper [first, last] format if serialization has removed some elements. Pass a default value for last to be used when only one element is present.

format_arg_pair(["foo"], last: {}) # => ["foo", {}] format_arg_pair([{ "foo" => :build }], last: {}) # => [{ "foo" => :build }, {}] format_arg_pair(["foo", { since: :catalina }], last: {}) # => ["foo", { since: :catalina }]

Parameters:

  • args (Array<(T.type_parameter(:U))>, Array<(T.type_parameter(:U), T.type_parameter(:V))>)
  • last (T.type_parameter(:V))

Returns:

  • (Array<(T.type_parameter(:U), T.type_parameter(:V))>)


233
234
235
236
237
238
239
240
241
242
243
# File 'api/formula_struct.rb', line 233

def self.format_arg_pair(args, last:)
  args = case args
  in [elem]
    [elem, last]
  in [elem1, elem2]
    [elem1, elem2]
  end

  # The case above is exhaustive so args will never be nil, but sorbet cannot infer that.
  T.must(args)
end

.from_hash(formula_hash) ⇒ FormulaStruct

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.

Parameters:

Returns:



11
12
13
14
15
16
# File 'api/formula_struct.rb', line 11

def self.from_hash(formula_hash)
  formula_hash = formula_hash.transform_keys(&:to_sym)
                             .slice(*decorator.all_props)
                             .compact_blank
  new(**formula_hash)
end

.stringify_symbol(value) ⇒ String?

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.

Converts a symbol to a string starting with :, otherwise returns the input.

stringify_symbol(:example) # => ":example" stringify_symbol("example") # => "example"

Parameters:

Returns:



250
251
252
253
254
# File 'api/formula_struct.rb', line 250

def self.stringify_symbol(value)
  return ":#{value}" if value.is_a?(Symbol)

  value
end

Instance Method Details

#bottle?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.

Returns:

  • (Boolean)


10
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 10

def bottle?; end

#deprecate?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.

Returns:

  • (Boolean)


13
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 13

def deprecate?; end

#disable?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.

Returns:

  • (Boolean)


16
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 16

def disable?; end

#head?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.

Returns:

  • (Boolean)


19
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 19

def head?; end

#keg_only?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.

Returns:

  • (Boolean)


22
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 22

def keg_only?; end

#no_autobump?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.

Returns:

  • (Boolean)


25
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 25

def no_autobump?; end

#pour_bottle?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.

Returns:

  • (Boolean)


28
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 28

def pour_bottle?; end

#serialize(bottle_tag: ::Utils::Bottles.tag) ⇒ Hash{String => T.untyped}

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.

Parameters:

Returns:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'api/formula_struct.rb', line 158

def serialize(bottle_tag: ::Utils::Bottles.tag)
  hash = self.class.decorator.all_props.filter_map do |prop|
    next if PREDICATES.any? { |predicate| prop == :"#{predicate}_present" }
    next if SKIP_SERIALIZATION.include?(prop)

    [prop.to_s, send(prop)]
  end.to_h

  if (bottle_hash = serialize_bottle(bottle_tag:))
    hash = hash.merge(bottle_hash)
  end

  hash = self.class.deep_stringify_symbols(hash)
  self.class.deep_compact_blank(hash)
end

#serialize_bottle(bottle_tag: ::Utils::Bottles.tag) ⇒ Hash{String => T.untyped}?

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.

Parameters:

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'api/formula_struct.rb', line 131

def serialize_bottle(bottle_tag: ::Utils::Bottles.tag)
  bottle_collector = ::Utils::Bottles::Collector.new
  bottle_checksums.each do |bottle_info|
    bottle_info = bottle_info.dup
    cellar = bottle_info.delete(:cellar) || :any
    tag = T.must(bottle_info.keys.first)
    checksum = T.cast(bottle_info.values.first, String)

    bottle_collector.add(
      ::Utils::Bottles::Tag.from_symbol(tag),
      checksum: Checksum.new(checksum),
      cellar:,
    )
  end
  return unless (bottle_spec = bottle_collector.specification_for(bottle_tag))

  tag = (bottle_spec.tag if bottle_spec.tag != bottle_tag)
  cellar = (bottle_spec.cellar if bottle_spec.cellar != DEFAULT_CELLAR)

  {
    "bottle_tag"      => tag&.to_sym,
    "bottle_cellar"   => cellar,
    "bottle_checksum" => bottle_spec.checksum.to_s,
  }
end

#service?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.

Returns:

  • (Boolean)


31
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 31

def service?; end

#service_name?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.

Returns:

  • (Boolean)


34
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 34

def service_name?; end

#service_run?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.

Returns:

  • (Boolean)


37
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 37

def service_run?; end

#stable?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.

Returns:

  • (Boolean)


40
# File 'sorbet/rbi/dsl/homebrew/api/formula_struct.rbi', line 40

def stable?; end