Class: AlexaModelMd::Intent
- Inherits:
-
Object
- Object
- AlexaModelMd::Intent
- Defined in:
- lib/alexa_modelmd.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#utterances ⇒ Object
readonly
Returns the value of attribute utterances.
Instance Method Summary collapse
-
#initialize(s, debug: false) ⇒ Intent
constructor
A new instance of Intent.
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
#code ⇒ Object (readonly)
Returns the value of attribute code.
17 18 19 |
# File 'lib/alexa_modelmd.rb', line 17 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/alexa_modelmd.rb', line 17 def name @name end |
#utterances ⇒ Object (readonly)
Returns the value of attribute utterances.
17 18 19 |
# File 'lib/alexa_modelmd.rb', line 17 def utterances @utterances end |