Class: AlexaGenerator::InteractionModel::Builder

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

Instance Method Summary collapse

Constructor Details

#initializeBuilder

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

#createObject



25
26
27
# File 'lib/alexa_generator/interaction_model.rb', line 25

def create
  InteractionModel.new(@intents, @utterance_templates, @bindings)
end