Class: Hbc::Artifact::AbstractUninstall

Inherits:
AbstractArtifact show all
Defined in:
Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb

Direct Known Subclasses

Uninstall, Zap

Constant Summary collapse

ORDERED_DIRECTIVES =
[
  :early_script,
  :launchctl,
  :quit,
  :signal,
  :login_item,
  :kext,
  :script,
  :pkgutil,
  :delete,
  :trash,
  :rmdir,
].freeze

Instance Attribute Summary collapse

Attributes inherited from AbstractArtifact

#cask, #config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractArtifact

#<=>, dirmethod, dsl_key, english_article, english_name, read_script_arguments, #to_s

Methods included from Predicable

#attr_predicate

Constructor Details

#initialize(cask, directives) ⇒ AbstractUninstall

Returns a new instance of AbstractUninstall



29
30
31
32
33
34
35
36
37
38
39
# File 'Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb', line 29

def initialize(cask, directives)
  super(cask)
  directives[:signal] = [*directives[:signal]].flatten.each_slice(2).to_a
  @directives = directives

  return unless directives.key?(:kext)

  cask.caveats do
    kext
  end
end

Instance Attribute Details

#directivesObject (readonly)

Returns the value of attribute directives



27
28
29
# File 'Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb', line 27

def directives
  @directives
end

Class Method Details

.from_args(cask, **directives) ⇒ Object



23
24
25
# File 'Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb', line 23

def self.from_args(cask, **directives)
  new(cask, directives)
end

Instance Method Details

#summarizeObject



45
46
47
# File 'Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb', line 45

def summarize
  to_h.flat_map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" } }.join(", ")
end

#to_hObject



41
42
43
# File 'Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb', line 41

def to_h
  directives.to_h
end