Class: Voice

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Voice

Returns a new instance of Voice.



2
3
4
# File 'lib/voice.rb', line 2

def initialize(options = {})
  run_command parse_options options
end

Instance Method Details

#create_argument(option, value) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/voice.rb', line 20

def create_argument option, value
  if option == :string
    "'#{value}'"
  else
    "--#{option}=#{value}"
  end
end

#parse_options(options) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/voice.rb', line 12

def parse_options options
  options_string = ""
  options.each do |option, value|
    options_string += "#{create_argument(option, value)} "
  end
  return options_string
end

#run_command(options) ⇒ Object



6
7
8
9
10
# File 'lib/voice.rb', line 6

def run_command options
  command = "say #{options} --progress"
  puts command
  system command
end