Module: Kernel
- Defined in:
- lib/say.rb
Instance Method Summary collapse
Instance Method Details
#say(*args, &block) ⇒ Object
36 37 38 |
# File 'lib/say.rb', line 36 def say(*args, &block) say_as(nil, *args, &block) end |
#say_as(voice, *args, &block) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/say.rb', line 40 def say_as(voice, *args, &block) args.push(block) if block = args.empty? ? ["I have nothing to say"] : args.map{|i| i.pretty_inspect} say_args = "" say_args += "-v #{voice}" if VOICES.include?(voice) .each {|i| `say #{say_args} #{i}`} if args.empty? nil elsif args.size == 1 args.first else args end end |