Class: Dialog
- Inherits:
-
Object
- Object
- Dialog
- Defined in:
- lib/load_dialogs.rb
Instance Attribute Summary collapse
-
#describe ⇒ Object
readonly
Returns the value of attribute describe.
-
#file ⇒ Object
Returns the value of attribute file.
-
#interactions ⇒ Object
readonly
Returns the value of attribute interactions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #create_example ⇒ Object
-
#initialize(args) ⇒ Dialog
constructor
A new instance of Dialog.
- #lex_chat ⇒ Object
Constructor Details
#initialize(args) ⇒ Dialog
Returns a new instance of Dialog.
32 33 34 35 36 |
# File 'lib/load_dialogs.rb', line 32 def initialize args args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#describe ⇒ Object (readonly)
Returns the value of attribute describe.
29 30 31 |
# File 'lib/load_dialogs.rb', line 29 def describe @describe end |
#file ⇒ Object
Returns the value of attribute file.
30 31 32 |
# File 'lib/load_dialogs.rb', line 30 def file @file end |
#interactions ⇒ Object (readonly)
Returns the value of attribute interactions.
29 30 31 |
# File 'lib/load_dialogs.rb', line 29 def interactions @interactions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
29 30 31 |
# File 'lib/load_dialogs.rb', line 29 def name @name end |
Instance Method Details
#create_example ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/load_dialogs.rb', line 46 def create_example() return if @interactions.size == 0 interactions = @interactions @@lex_chat = lex_chat() ::RSpec.describe "#{@describe} #{@name}" do it @name do while interactions.size > 1 do resp = @@lex_chat.(interactions[0]) expect(resp[:message]).to match(interactions[1]) interactions = interactions.drop(2) end resp = @@lex_chat.(interactions[0]) if interactions.size == 1 end end end |
#lex_chat ⇒ Object
42 43 44 |
# File 'lib/load_dialogs.rb', line 42 def lex_chat @lex_chat ||= BotSpec::AWS::LexService.new({botname: LoadDialogs.botname}) end |