Class: BotPlatform::Dialogs::WaterfallStepContext

Inherits:
DialogContext
  • Object
show all
Defined in:
lib/bot_platform/dialogs/waterfall_step_context.rb

Instance Attribute Summary collapse

Attributes inherited from DialogContext

#dialog_stack, #dialogs, #turn_context

Instance Method Summary collapse

Methods inherited from DialogContext

#active_dialog, #continue_dialog, #prompt, #replace_dialog, #reprompt, #start_dialog, #stop_active_dialog, #stop_all, #stop_dialog

Methods included from Asserts

#assert_activity_is_not_null, #assert_activity_list_is_not_null, #assert_activity_type_is_not_null, #assert_context_is_not_null, #assert_conversation_reference_is_not_null, #assert_dialog_context_is_valid, #assert_dialog_id_is_valid, #assert_dialog_is_uniq, #assert_dialog_is_valid, #assert_dialog_set_is_valid, #assert_dialog_state_is_valid, #assert_is_not_empty, #assert_middleware_is_not_null, #assert_middleware_list_is_not_null, #assert_prompt_options_is_valid, #assert_turn_context_is_valid, #assert_waterfall_step_context_is_valid

Constructor Details

#initialize(parent, dc, options, values, index, reason, result) ⇒ WaterfallStepContext

Returns a new instance of WaterfallStepContext.



9
10
11
12
13
14
15
16
17
18
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 9

def initialize(parent, dc, options, values, index, reason, result)
  super(dc.dialogs, dc.turn_context, DialogState.new(dc.dialog_stack))
  @parent_waterfall_dialog = parent
  @next_called = false
  @options = options
  @index = index
  @reason = reason
  @result = result
  @values = values
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



6
7
8
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 6

def index
  @index
end

#next_calledObject

Returns the value of attribute next_called.



7
8
9
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 7

def next_called
  @next_called
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 6

def options
  @options
end

#parent_waterfall_dialogObject (readonly)

Returns the value of attribute parent_waterfall_dialog.



6
7
8
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 6

def parent_waterfall_dialog
  @parent_waterfall_dialog
end

#reasonObject (readonly)

Returns the value of attribute reason.



6
7
8
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 6

def reason
  @reason
end

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 6

def result
  @result
end

#valuesObject (readonly)

Returns the value of attribute values.



6
7
8
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 6

def values
  @values
end

Instance Method Details

#next(result = nil) ⇒ Object



20
21
22
23
24
25
# File 'lib/bot_platform/dialogs/waterfall_step_context.rb', line 20

def next(result=nil)
  raise "cannot use next() twice." if @next_called

  @next_called = true
  return @parent_waterfall_dialog.resume(self, DialogReason::NEXT_CALLED, result)
end