Module: Talks

Defined in:
lib/talks.rb,
lib/talks/hooks.rb,
lib/talks/version.rb,
lib/talks/configuration.rb

Defined Under Namespace

Modules: Hooks Classes: Configuration

Constant Summary collapse

VOICES =
{
  :say => %w(
    agnes albert alex bad bahh bells boing bruce bubbles cellos
    deranged fred good hysterical junior kathy pipe princess ralph
    trinoids vicki victoria whisper zarvox
  ),
  :espeak => %w(en+m1 en+m2 en+m3 en+m4 en+m5 en+m6 en+m7
    en+f1 en+f2 en+f3 en+f4 en+f5 en+f6 en+f7
  )
}
TYPES =
[:info, :warn, :success, :error]
VERSION =
'0.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



20
21
22
# File 'lib/talks.rb', line 20

def config
  @config
end

Class Method Details

.add_hooks(command) ⇒ Object



42
43
44
# File 'lib/talks.rb', line 42

def add_hooks(command)
  Talks::Hooks.create command
end

.configure(options) ⇒ Object



22
23
24
# File 'lib/talks.rb', line 22

def configure(options)
  @config = Talks::Configuration.new(options)
end

.say(message, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/talks.rb', line 30

def say(message, options = {})
  type = options[:type] || :default
  case config.engine
  when 'say'
    `say -v #{say_voice(type, options)} '#{message}'`
  when 'espeak'
    `espeak -v #{say_voice(type, options)} '#{message}'`
  else
    abort "Don't know that engine now: #{config.engine}"
  end
end

.voicesObject



26
27
28
# File 'lib/talks.rb', line 26

def voices
  VOICES
end