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.
8 9 10 11 12 |
# File 'lib/mounce.rb', line 8 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.
6 7 8 |
# File 'lib/mounce.rb', line 6 def artist @artist end |
#track ⇒ Object (readonly)
Returns the value of attribute track.
6 7 8 |
# File 'lib/mounce.rb', line 6 def track @track end |
Instance Method Details
#message(tag = '#music') ⇒ Object
14 15 16 17 |
# File 'lib/mounce.rb', line 14 def (tag='#music') text = [@artist, @track].compact.join(' - ') "#{tag} #{text}" end |
#share! ⇒ Object
19 20 21 |
# File 'lib/mounce.rb', line 19 def share! `curl #{@config['api']} -u #{@config['username']}:#{@config['password']} --data-urlencode status="#{}" -d source="mounce"` end |