Class: WitBot::Context
- Inherits:
-
Object
- Object
- WitBot::Context
- Defined in:
- lib/wit_bot/models/context.rb
Instance Attribute Summary collapse
- #entities ⇒ Object
-
#hash ⇒ Object
writeonly
Sets the attribute hash.
-
#location ⇒ Object
Returns the value of attribute location.
-
#reference_time ⇒ Object
Returns the value of attribute reference_time.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
Instance Attribute Details
#entities ⇒ Object
10 11 12 |
# File 'lib/wit_bot/models/context.rb', line 10 def entities @entities ||= ContextEntities.new end |
#hash=(value) ⇒ Object (writeonly)
Sets the attribute hash
4 5 6 |
# File 'lib/wit_bot/models/context.rb', line 4 def hash=(value) @hash = value end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/wit_bot/models/context.rb', line 3 def location @location end |
#reference_time ⇒ Object
Returns the value of attribute reference_time.
3 4 5 |
# File 'lib/wit_bot/models/context.rb', line 3 def reference_time @reference_time end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/wit_bot/models/context.rb', line 3 def state @state end |
Instance Method Details
#as_json ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/wit_bot/models/context.rb', line 14 def as_json h = {} h[:state] = state if state h[:reference_time] = reference_time.iso8601 if reference_time h[:entities] = entities if @entities h[:location] = location if location h end |
#empty? ⇒ Boolean
6 7 8 |
# File 'lib/wit_bot/models/context.rb', line 6 def empty? as_json.empty? end |