Class: WitBot::EntityModel
- Inherits:
-
Object
- Object
- WitBot::EntityModel
- Defined in:
- lib/wit_bot/models/wit/entity/entity_model.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#others ⇒ Object
Returns the value of attribute others.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(entity, role, raw) ⇒ EntityModel
constructor
A new instance of EntityModel.
- #to_s ⇒ Object
Constructor Details
#initialize(entity, role, raw) ⇒ EntityModel
Returns a new instance of EntityModel.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 6 def initialize(entity, role, raw) @entity = entity @role = role @raw = raw.with_indifferent_access @value = case @raw[:type].to_sym when :value @raw[:value].to_s else @raw[:value] end @others = [] end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
4 5 6 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 4 def entity @entity end |
#others ⇒ Object
Returns the value of attribute others.
3 4 5 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 3 def others @others end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
4 5 6 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 4 def raw @raw end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
4 5 6 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 4 def role @role end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 4 def value @value end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 21 def to_s value.to_s end |