class Fluent::SayOutput

Public Instance Methods

configure(conf) click to toggle source
# File lib/fluent/plugin/out_say.rb, line 5
def configure(conf)
  @field = conf['field'] || 'message'
  @voice = conf['voice']
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_say.rb, line 10
def emit(tag, es, chain)
  es.each{|time,record|
    message = record[@field]
    @voice = record['voice'] if record['voice']
    next unless message
    args = [ message.to_s ]
    args.push("-v#{@voice}") if @voice
    system('say', *args)
  }
  chain.next
end