Class: TapDance::Tap

Inherits:
Object
  • Object
show all
Defined in:
lib/tap_dance/tap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, url, opts = {}) ⇒ Tap

Returns a new instance of Tap.



9
10
11
12
13
# File 'lib/tap_dance/tap.rb', line 9

def initialize(name, url, opts={})
  @name = name.to_sym
  @url  = url.to_s
  @opts = opts
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/tap_dance/tap.rb', line 6

def name
  @name
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/tap_dance/tap.rb', line 7

def url
  @url
end

Instance Method Details

#entapObject



15
16
17
# File 'lib/tap_dance/tap.rb', line 15

def entap
  BrewCLI.tap(@url)
end

#tapped?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
# File 'lib/tap_dance/tap.rb', line 23

def tapped?
  BrewCLI.tap_list.out.each_line { |t|
    return true if @url == t.strip
  }

  return false
end

#to_sObject



31
32
33
# File 'lib/tap_dance/tap.rb', line 31

def to_s
  "#{@name}:#{@url}"
end

#untapObject



19
20
21
# File 'lib/tap_dance/tap.rb', line 19

def untap
  BrewCLI.untap(@url)
end