Class: Cask::DSL::ConflictsWith

Inherits:
Hash
  • Object
show all
Defined in:
brew/Library/Homebrew/cask/dsl/conflicts_with.rb

Constant Summary collapse

VALID_KEYS =
[
  :formula,
  :cask,
  :macos,
  :arch,
  :x11,
  :java,
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**pairs) ⇒ ConflictsWith

Returns a new instance of ConflictsWith



18
19
20
21
22
23
24
# File 'brew/Library/Homebrew/cask/dsl/conflicts_with.rb', line 18

def initialize(**pairs)
  pairs.assert_valid_keys!(*VALID_KEYS)

  super(Hash[pairs.map { |k, v| [k, Set.new([*v])] }])

  self.default = Set.new
end

Instance Method Details

#to_json(generator) ⇒ Object



26
27
28
# File 'brew/Library/Homebrew/cask/dsl/conflicts_with.rb', line 26

def to_json(generator)
  Hash[map { |k, v| [k, v.to_a] }].to_json(generator)
end