class Gvg::Cli

Public Instance Methods

generate() click to toggle source
# File lib/gvg/cli.rb, line 16
def generate
  agnot = Gvg::Agnot.new
  parser = Gvg::Parser.new
  defaults = { source: File.join(resource_path(), 'hello.json'), destination: '/tmp/hello.vxml' }
  notfound = File.join(resource_path(), '404.json')

  source = options[:source] || defaults[:source]
  source = File.file?(source) ? source : notfound

  automaton = parser.parse(source)

  agnot.start
  states = automaton['states']
  for state in states
    agnot.send(state['type'], state['audio'])
  end
  agnot.stop
end