Class: BrewCaskTools::Caskroom

Inherits:
Object
  • Object
show all
Defined in:
lib/bct/caskroom.rb

Overview

Represents a list of Casks.

Direct Known Subclasses

Tasks::Cleanup, Tasks::Upgrade

Instance Method Summary collapse

Constructor Details

#initializeCaskroom

Returns a new instance of Caskroom.



6
7
8
# File 'lib/bct/caskroom.rb', line 6

def initialize
  super
end

Instance Method Details

#casksArray

An array of installed casks

Returns:

  • (Array)


12
13
14
# File 'lib/bct/caskroom.rb', line 12

def casks
  @casks ||= `brew cask ls`.split("\n")
end

#enumerateObject

Parameters:

  • (Proc)


17
18
19
20
21
# File 'lib/bct/caskroom.rb', line 17

def enumerate
  casks.map do |cask|
    yield Cask.new(cask)
  end
end

#get(cask_name) ⇒ BrewCaskTools::Cask

Parameters:

  • cask_name (String)

Returns:



25
26
27
28
# File 'lib/bct/caskroom.rb', line 25

def get(cask_name)
  cask = casks.select { |name| name == cask_name }
  cask.empty? ? nil : Cask.new(cask.first)
end