Module: NluAdapterIntentCollection

Included in:
NluAdapter::Adapters::Dialogflow::IntentCollection, NluAdapter::Adapters::Lex::IntentCollection
Defined in:
lib/nlu_adapter/intent_collection.rb

Overview

Class represents a collection of Intents

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#intentsObject

Returns the value of attribute intents.



5
6
7
# File 'lib/nlu_adapter/intent_collection.rb', line 5

def intents
  @intents
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/nlu_adapter/intent_collection.rb', line 5

def name
  @name
end

Instance Method Details

#initialize(name, intents) ⇒ Object

Constructor



8
9
10
11
# File 'lib/nlu_adapter/intent_collection.rb', line 8

def initialize(name, intents)
	@name = name
	@intents = intents
end

#to_hHash

Convert self to Hash

Returns:

  • (Hash)

    ruby hash



16
17
18
19
20
21
# File 'lib/nlu_adapter/intent_collection.rb', line 16

def to_h
	{
		:name => @name,
		:intents => @intents.map { |i| i.to_h }
	}
end

#to_jsonJson

Convert self to Json

Returns:

  • (Json)

    json



26
27
28
# File 'lib/nlu_adapter/intent_collection.rb', line 26

def to_json
	to_h.to_json
end