Module: Voice
- Defined in:
- lib/voice.rb
Constant Summary collapse
- PLATFORM_IS_OSX =
(Object::RUBY_PLATFORM =~ /darwin/i)
- DEFAULT_VOICE =
'Kathy'
- NOVELTY_VOICES =
["Albert", "Bad News", "Bahh", "Bells", "Boing", "Bubbles", "Cellos", "Deranged", "Good News", "Hysterical", "Pipe Organ", "Trinoides", "Whisper", "Zarvox" ]
- @@all =
nil
- @@novelty =
nil
Class Method Summary collapse
- .all(opts = {}) ⇒ Object
- .default ⇒ Object
- .get_rand(opts = {}) ⇒ Object
- .say(text, opts = {}) ⇒ Object
Class Method Details
.all(opts = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/voice.rb', line 23 def self.all(opts={}) return nil if @@all.nil? opts = {} unless opts.is_a?(Hash) if opts[:novelty] == 'only' @@novelty elsif opts[:novelty] @@all + @@novelty else @@all end end |
.default ⇒ Object
36 37 38 39 |
# File 'lib/voice.rb', line 36 def self.default return DEFAULT_VOICE if @@all.include?(DEFAULT_VOICE) return @@all.first end |
.get_rand(opts = {}) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/voice.rb', line 41 def self.get_rand(opts={}) return nil if @@all.nil? opts = {} unless opts.is_a?(Hash) voices = self.all(opts) voices[rand(voices.size)] end |