Class: WitBot::WitModel::Intent
- Defined in:
- lib/wit_bot/models/wit/intent.rb
Constant Summary collapse
- @@intents =
{}
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id, doc: nil, metadata: nil, expressions: [], states: [], meta: {states: []}, request: false) ⇒ Intent
constructor
A new instance of Intent.
Methods inherited from Base
all, #create, #delete, #from_response_data, get, #get, #on_delete, #to_h
Constructor Details
#initialize(id, doc: nil, metadata: nil, expressions: [], states: [], meta: {states: []}, request: false) ⇒ Intent
Returns a new instance of Intent.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/wit_bot/models/wit/intent.rb', line 10 def initialize(id, doc: nil, metadata: nil, expressions: [], states: [], meta: {states: []}, request: false) super @name = id @doc = doc @metadata = [:states].concat states @expressions = process_expressions expressions @meta = @@intents[@name] = self end |
Class Method Details
.find(name) ⇒ Object
25 26 27 |
# File 'lib/wit_bot/models/wit/intent.rb', line 25 def self.find(name) @@intents[name] || self.new(name) end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 |
# File 'lib/wit_bot/models/wit/intent.rb', line 29 def ==(other) self.name == other.name end |