Class: BrewCaskTools::Caskroom
- Inherits:
-
Object
- Object
- BrewCaskTools::Caskroom
- Defined in:
- lib/bct/caskroom.rb
Overview
Represents a list of Casks.
Direct Known Subclasses
Instance Method Summary collapse
-
#casks ⇒ Array
An array of installed casks.
- #enumerate ⇒ Object
- #get(cask_name) ⇒ BrewCaskTools::Cask
-
#initialize ⇒ Caskroom
constructor
A new instance of Caskroom.
Constructor Details
#initialize ⇒ Caskroom
Returns a new instance of Caskroom.
6 7 8 |
# File 'lib/bct/caskroom.rb', line 6 def initialize super end |
Instance Method Details
#casks ⇒ Array
An array of installed casks
12 13 14 |
# File 'lib/bct/caskroom.rb', line 12 def casks @casks ||= `brew cask ls`.split("\n") end |
#enumerate ⇒ Object
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
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 |