Class: AlexaModelMd::Intent

Inherits:
Object
  • Object
show all
Defined in:
lib/alexa_modelmd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s, debug: false) ⇒ Intent

Returns a new instance of Intent.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/alexa_modelmd.rb', line 19

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



17
18
19
# File 'lib/alexa_modelmd.rb', line 17

def code
  @code
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/alexa_modelmd.rb', line 17

def name
  @name
end

#utterancesObject (readonly)

Returns the value of attribute utterances.



17
18
19
# File 'lib/alexa_modelmd.rb', line 17

def utterances
  @utterances
end