Class: WitBot::EntityValue
- Inherits:
-
Object
- Object
- WitBot::EntityValue
- Defined in:
- lib/wit_bot/models/wit/entity/entity_value.rb
Instance Attribute Summary collapse
-
#expressions ⇒ Object
Returns the value of attribute expressions.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, expressions = [value]) ⇒ EntityValue
constructor
A new instance of EntityValue.
- #to_h ⇒ Object (also: #to_hash)
Constructor Details
#initialize(value, expressions = [value]) ⇒ EntityValue
Returns a new instance of EntityValue.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/wit_bot/models/wit/entity/entity_value.rb', line 5 def initialize(value, expressions=[value]) if value.is_a? Hash hash = value.with_indifferent_access @value = hash[:value] @expressions = hash[:expressions] else @value = value @expressions = expressions end end |
Instance Attribute Details
#expressions ⇒ Object
Returns the value of attribute expressions.
3 4 5 |
# File 'lib/wit_bot/models/wit/entity/entity_value.rb', line 3 def expressions @expressions end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/wit_bot/models/wit/entity/entity_value.rb', line 3 def value @value end |
Instance Method Details
#to_h ⇒ Object Also known as: to_hash
16 17 18 |
# File 'lib/wit_bot/models/wit/entity/entity_value.rb', line 16 def to_h {value: value, expressions: expressions} end |