Class: Cask::DSL::Container Private

Inherits:
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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nested: nil, type: nil) ⇒ 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.



14
15
16
17
18
19
20
21
22
# File 'cask/dsl/container.rb', line 14

def initialize(nested: nil, type: nil)
  @nested = nested
  @type = type

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

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

Instance Attribute Details

#nestedObject

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.



12
13
14
# File 'cask/dsl/container.rb', line 12

def nested
  @nested
end

#typeObject

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.



12
13
14
# File 'cask/dsl/container.rb', line 12

def type
  @type
end

Instance Method Details

#pairsObject

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.



24
25
26
# File 'cask/dsl/container.rb', line 24

def pairs
  instance_variables.to_h { |ivar| [ivar[1..].to_sym, instance_variable_get(ivar)] }.compact
end

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



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

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.



28
29
30
# File 'cask/dsl/container.rb', line 28

def to_yaml
  pairs.to_yaml
end