Class: Walkon::EntranceMusic

Inherits:
Object
  • Object
show all
Defined in:
lib/walkon/entrance_music.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#deviceObject (readonly)

Returns the value of attribute device.



7
8
9
# File 'lib/walkon/entrance_music.rb', line 7

def device
  @device
end

#filenameObject (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?

Returns:

  • (Boolean)


14
15
16
# File 'lib/walkon/entrance_music.rb', line 14

def exists?
  File.exists? filename
end

#playObject



20
21
22
23
# File 'lib/walkon/entrance_music.rb', line 20

def play
  return false unless exists?
  `xmms #{filename}`
end