Class: WitBot::EntityValue

Inherits:
Object
  • Object
show all
Defined in:
lib/wit_bot/models/wit/entity/entity_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#expressionsObject

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

#valueObject

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_hObject 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