Class: WitBot::EntityModel
- Inherits:
-
Object
- Object
- WitBot::EntityModel
- Defined in:
- lib/wit_bot/models/wit/entity/entity_model.rb
Instance Attribute Summary collapse
-
#all ⇒ Object
Returns the value of attribute all.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#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
- #==(other) ⇒ Object
-
#initialize(entity, role, raw) ⇒ EntityModel
constructor
A new instance of EntityModel.
- #others ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(entity, role, raw) ⇒ EntityModel
Returns a new instance of EntityModel.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 36 def initialize(entity, role, raw) @entity = entity @role = role @raw = raw.with_indifferent_access @value = case @raw[:type] && @raw[:type].to_sym when :value @raw[:value].to_s else @raw[:value] end @others = [] end |
Instance Attribute Details
#all ⇒ Object
Returns the value of attribute all.
33 34 35 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 33 def all @all end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
34 35 36 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 34 def entity @entity end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
34 35 36 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 34 def raw @raw end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
34 35 36 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 34 def role @role end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
34 35 36 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 34 def value @value end |
Instance Method Details
#==(other) ⇒ Object
55 56 57 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 55 def ==(other) self.entity == other.entity && self.value == other.value end |
#others ⇒ Object
51 52 53 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 51 def others all - [self] end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/wit_bot/models/wit/entity/entity_model.rb', line 59 def to_s value.to_s end |