Class: AlexaGenerator::InteractionModel::Builder
- Inherits:
-
Object
- Object
- AlexaGenerator::InteractionModel::Builder
- Defined in:
- lib/alexa_generator/interaction_model.rb
Instance Method Summary collapse
- #add_intent(name, &block) ⇒ Object
- #create ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
12 13 14 15 16 |
# File 'lib/alexa_generator/interaction_model.rb', line 12 def initialize @intents = [] @bindings = [] @utterance_templates = [] end |
Instance Method Details
#add_intent(name, &block) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/alexa_generator/interaction_model.rb', line 18 def add_intent(name, &block) builder = Intent.build(name, &block) @bindings.concat(builder.bindings) @utterance_templates.concat(builder.utterance_templates) @intents.push(builder.create) end |
#create ⇒ Object
25 26 27 |
# File 'lib/alexa_generator/interaction_model.rb', line 25 def create InteractionModel.new(@intents, @utterance_templates, @bindings) end |