Class: Walkon::EntranceMusic
- Inherits:
-
Object
- Object
- Walkon::EntranceMusic
- Defined in:
- lib/walkon/entrance_music.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #exists? ⇒ Boolean (also: #present?)
-
#initialize(from_device) ⇒ EntranceMusic
constructor
A new instance of EntranceMusic.
- #play ⇒ Object
Constructor Details
#initialize(from_device) ⇒ EntranceMusic
Returns a new instance of EntranceMusic.
9 10 11 12 |
# File 'lib/walkon/entrance_music.rb', line 9 def initialize from_device @device = from_device @filename = "#{prefix}/#{@device.mac_address}.mp3" end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
7 8 9 |
# File 'lib/walkon/entrance_music.rb', line 7 def device @device end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
7 8 9 |
# File 'lib/walkon/entrance_music.rb', line 7 def filename @filename end |
Instance Method Details
#exists? ⇒ Boolean Also known as: present?
14 15 16 |
# File 'lib/walkon/entrance_music.rb', line 14 def exists? File.exists? filename end |
#play ⇒ Object
20 21 22 23 |
# File 'lib/walkon/entrance_music.rb', line 20 def play return false unless exists? `xmms #{filename}` end |