Class: Retest::Sounds::MacOS

Inherits:
Object
  • Object
show all
Defined in:
lib/retest/sounds.rb

Instance Method Summary collapse

Constructor Details

#initialize(kernel: Kernel, thread: Thread) ⇒ MacOS

Returns a new instance of MacOS.



16
17
18
19
# File 'lib/retest/sounds.rb', line 16

def initialize(kernel: Kernel, thread: Thread)
  @kernel = kernel
  @thread = thread
end

Instance Method Details

#play(sound) ⇒ Object Also known as: update



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/retest/sounds.rb', line 21

def play(sound)
  args = case sound
  when :tests_fail
    ['afplay', '/System/Library/Sounds/Sosumi.aiff']
  when :tests_pass
    ['afplay', '/System/Library/Sounds/Funk.aiff']
  when :start
    ['afplay', '/System/Library/Sounds/Blow.aiff']
  when :question
    ['afplay', '/System/Library/Sounds/Glass.aiff']
  else
    raise ArgumentError.new("No sounds were found for type: #{sound}.")
  end

  @thread.new { @kernel.system(*args) }
end