Class: Cask::DSL::Container Private

Inherits:
Object
  • Object
show all
Defined in:
cask/dsl/container.rb

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 container stanza.

Constant Summary collapse

VALID_KEYS =

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.

Set.new([
  :type,
  :nested,
]).freeze

Instance Method Summary collapse

Constructor Details

#initialize(pairs = {}) ⇒ Container

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 a new instance of Container.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'cask/dsl/container.rb', line 19

def initialize(pairs = {})
  @pairs = pairs
  pairs.each do |key, value|
    raise "invalid container key: #{key.inspect}" unless VALID_KEYS.include?(key)

    send(:"#{key}=", value)
  end

  return if type.nil?
  return unless UnpackStrategy.from_type(type).nil?

  raise "invalid container type: #{type.inspect}"
end

Instance Method Details

#to_sObject

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.



37
38
39
# File 'cask/dsl/container.rb', line 37

def to_s
  @pairs.inspect
end

#to_yamlObject

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.



33
34
35
# File 'cask/dsl/container.rb', line 33

def to_yaml
  @pairs.to_yaml
end