Class: Wit::REST::EntityArray

Inherits:
Object
  • Object
show all
Defined in:
lib/wit_ruby/rest/entity.rb

Overview

Internal wrapper for multiple entities for a given result.

Instance Method Summary collapse

Constructor Details

#initialize(resultData) ⇒ Wit::REST::MultiEntity

Creates an instance that holds array of intents.

Parameters:

  • resultData (Array)

    array of hashes of entity values.



18
19
20
21
22
23
24
25
# File 'lib/wit_ruby/rest/entity.rb', line 18

def initialize(resultData)

  entity_arr = Array.new
  resultData.each do |entity|
    entity_arr << Entity.new(entity)
  end
  @entities = entity_arr
end

Instance Method Details

#[](num) ⇒ Object

Allow for index calls to the specific intents in the instance.

Parameters:

  • num (Integer)

    index of the specific intent.



30
31
32
# File 'lib/wit_ruby/rest/entity.rb', line 30

def [](num)
  @entities[num]
end