Class: ACappella::Singer

Inherits:
Object
  • Object
show all
Defined in:
lib/acappella/singer.rb

Instance Method Summary collapse

Constructor Details

#initialize(voice) ⇒ Singer

Returns a new instance of Singer.



5
6
7
8
9
# File 'lib/acappella/singer.rb', line 5

def initialize(voice)
  raise ACappella::VoiceTypeError.new("can't sing voice.") unless valid_voice?(voice)

  @voice = voice
end

Instance Method Details

#sing(lyrics) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/acappella/singer.rb', line 11

def sing(lyrics)
  logging(lyrics)

  shellescaped_args = [@voice, lyrics].shelljoin

  system("say -v #{shellescaped_args}")
end