Class: Cask::DSL::Container Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class corresponding to the container stanza.

Constant Summary collapse

VALID_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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

Instance Method Summary collapse

Constructor Details

#initialize(pairs = {}) ⇒ Container

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Container.


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'Library/Homebrew/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. You should avoid using this method if possible, as it may be removed or be changed in the future.


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

def to_s
  @pairs.inspect
end

#to_yamlObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


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

def to_yaml
  @pairs.to_yaml
end