Class: Dialogue::ConversationTemplate

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, &block) ⇒ ConversationTemplate

Returns a new instance of ConversationTemplate.



5
6
7
8
# File 'lib/dialogue/conversation_template.rb', line 5

def initialize(name=nil, &block)
  @name = name
  @template = block
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/dialogue/conversation_template.rb', line 3

def name
  @name
end

#templateObject (readonly)

Returns the value of attribute template.



3
4
5
# File 'lib/dialogue/conversation_template.rb', line 3

def template
  @template
end

Class Method Details

.build(name, &block) ⇒ Object



10
11
12
# File 'lib/dialogue/conversation_template.rb', line 10

def self.build(name, &block)
  ConversationTemplate.new name, &block
end

Instance Method Details

#registerObject



14
15
16
17
# File 'lib/dialogue/conversation_template.rb', line 14

def register
  Dialogue.register_template self
  self
end

#start(message, options = {}) ⇒ Object



19
20
21
# File 'lib/dialogue/conversation_template.rb', line 19

def start(message, options={})
  ConversationTemplateRunner.new(message, options).run self
end