Class: ACappella::Singer
- Inherits:
-
Object
- Object
- ACappella::Singer
- Defined in:
- lib/acappella/singer.rb
Instance Method Summary collapse
-
#initialize(voice) ⇒ Singer
constructor
A new instance of Singer.
- #sing(lyrics) ⇒ Object
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 |