class ZugZug::Soundboard
Constants
- ALLIANCE_SOUNDS
- HORDE_SOUNDS
Public Class Methods
board_for(faction)
click to toggle source
# File lib/zug_zug/soundboard.rb, line 15 def self.board_for(faction) case faction when HORDE HORDE_SOUNDS when ALLIANCE ALLIANCE_SOUNDS else fail ArgumentError, "#{faction} is not a valid faction (valid factions are #{HORDE} and #{ALLIANCE})" end end
new(faction, plugin: default_plugin)
click to toggle source
# File lib/zug_zug/soundboard.rb, line 26 def initialize(faction, plugin: default_plugin) @_board = Soundboard.board_for faction @_plugin = plugin end
Public Instance Methods
play(file)
click to toggle source
# File lib/zug_zug/soundboard.rb, line 39 def play(file) @_plugin.call(file) end
sound_file(sound)
click to toggle source
# File lib/zug_zug/soundboard.rb, line 43 def sound_file(sound) file_name = @_board.fetch sound File.join __dir__, "sounds", file_name end
work_is_over()
click to toggle source
# File lib/zug_zug/soundboard.rb, line 35 def work_is_over play sound_file(:work_complete) end
work_starts()
click to toggle source
# File lib/zug_zug/soundboard.rb, line 31 def work_starts play sound_file(:zug_zug) end
Private Instance Methods
default_plugin()
click to toggle source
# File lib/zug_zug/soundboard.rb, line 50 def default_plugin if RUBY_PLATFORM.include? "x86_64-darwin" ->(file) { system "afplay", file } else ->(file) { true } end end