class AlexaModelMd::Intent

Attributes

code[R]
name[R]
utterances[R]

Public Class Methods

new(s, debug: false) click to toggle source
# File lib/alexa_modelmd.rb, line 24
def initialize(s, debug: false)
  
  @debug = debug
  puts ('Intent | s: ' + s.inspect).debug if @debug
  html = Kramdown::Document.new(Martile.new(s).to_html).to_html
  doc = Rexle.new("<root9>%s</root9>" % html)
  @name = doc.root.element('h2/text()').to_s
  @utterances = doc.root.xpath('ul/li/text()').map(&:to_s)
  puts ('doc: ' + doc.root.xml.inspect).debug if @debug
  @code = doc.root.element('//code/text()').to_s

end