Class: Wit::REST::MultiIntent
- Defined in:
- lib/wit_ruby/rest/intent.rb
Overview
MultiIntent wraps around results that are an array with intents.
Instance Method Summary collapse
-
#[](num) ⇒ Wit::REST::Result
Overide that assists in calling the proper index in the array of intent results.
-
#each ⇒ Wit::REST::Result
Assists in going through each intent in the instance variable.
-
#initialize(resultData, requestRest = nil, requestPath = nil, requestBody = nil) ⇒ Wit::REST::MultiIntent
constructor
Generates instance variable that holds intents as Wit::REST::Result.
Methods inherited from Result
#empty?, #entities, #method_missing, #raw_data, #refreshable?, #restBody, #restCode, #restPath
Constructor Details
#initialize(resultData, requestRest = nil, requestPath = nil, requestBody = nil) ⇒ Wit::REST::MultiIntent
Generates instance variable that holds intents as Wit::REST::Result.
66 67 68 69 70 71 72 |
# File 'lib/wit_ruby/rest/intent.rb', line 66 def initialize(resultData, requestRest=nil, requestPath=nil, requestBody=nil) ## Pass in empty hash to default to method missing for everything not defined here. super({}, requestRest, requestPath, requestBody) @intents = resultData.map do |intent| Result.new(intent) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wit::REST::Result
Instance Method Details
#[](num) ⇒ Wit::REST::Result
Overide that assists in calling the proper index in the array of intent results.
78 79 80 |
# File 'lib/wit_ruby/rest/intent.rb', line 78 def [](num) @intents[num] end |
#each ⇒ Wit::REST::Result
Assists in going through each intent in the instance variable.
85 86 87 88 89 |
# File 'lib/wit_ruby/rest/intent.rb', line 85 def each @intents.each do |intent| lambda{intent} end end |