Class: TapDance::Tap
- Inherits:
-
Object
- Object
- TapDance::Tap
- Defined in:
- lib/tap_dance/tap.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #entap ⇒ Object
-
#initialize(name, url, opts = {}) ⇒ Tap
constructor
A new instance of Tap.
- #tapped? ⇒ Boolean
- #to_s ⇒ Object
- #untap ⇒ Object
Constructor Details
#initialize(name, url, opts = {}) ⇒ 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
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/tap_dance/tap.rb', line 6 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/tap_dance/tap.rb', line 7 def url @url end |
Instance Method Details
#entap ⇒ Object
15 16 17 |
# File 'lib/tap_dance/tap.rb', line 15 def entap BrewCLI.tap(@url) end |
#tapped? ⇒ 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_s ⇒ Object
31 32 33 |
# File 'lib/tap_dance/tap.rb', line 31 def to_s "#{@name}:#{@url}" end |
#untap ⇒ Object
19 20 21 |
# File 'lib/tap_dance/tap.rb', line 19 def untap BrewCLI.untap(@url) end |