Class: Mounce
- Inherits:
-
Object
- Object
- Mounce
- Defined in:
- lib/mounce.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#track ⇒ Object
readonly
Returns the value of attribute track.
Instance Method Summary collapse
-
#initialize(config_file = '~/.mounce.yml') ⇒ Mounce
constructor
A new instance of Mounce.
- #message(tag = '#music') ⇒ Object
- #share! ⇒ Object
Constructor Details
#initialize(config_file = '~/.mounce.yml') ⇒ Mounce
Returns a new instance of Mounce.
7 8 9 10 11 |
# File 'lib/mounce.rb', line 7 def initialize(config_file='~/.mounce.yml') config(File.(config_file)) @itunes = OSA.app('iTunes') @artist, @track = find_song_information end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
5 6 7 |
# File 'lib/mounce.rb', line 5 def artist @artist end |
#track ⇒ Object (readonly)
Returns the value of attribute track.
5 6 7 |
# File 'lib/mounce.rb', line 5 def track @track end |
Instance Method Details
#message(tag = '#music') ⇒ Object
13 14 15 16 |
# File 'lib/mounce.rb', line 13 def (tag='#music') text = [@artist, @track].compact.join(' - ') "#{tag} #{text}" end |
#share! ⇒ Object
18 19 20 |
# File 'lib/mounce.rb', line 18 def share! `curl #{@config['api']} -u #{@config['username']}:#{@config['password']} -d status="#{message}" -d source="mounce"` end |