Class: DucklingService::IntervalOption
- Inherits:
-
Struct
- Object
- Struct
- DucklingService::IntervalOption
- Defined in:
- src/services/duckling_service.rb
Instance Attribute Summary collapse
-
#from ⇒ Time
The start time.
-
#grain ⇒ 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'
The time grain.
-
#to ⇒ Time
The end time.
Instance Method Summary collapse
-
#interval? ⇒ true
Is this an interval of values?.
-
#to_time_using_from ⇒ TimeOption
Convert to a time option using the start time of the interval.
-
#to_time_using_to ⇒ TimeOption
Convert to a time option using the end time of the interval.
-
#value? ⇒ false
Is this a single value, or an interval of values?.
Instance Attribute Details
#from ⇒ Time
Returns the start time
190 191 192 |
# File 'src/services/duckling_service.rb', line 190 def from @from end |
#grain ⇒ 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'
Returns the time grain
196 197 198 |
# File 'src/services/duckling_service.rb', line 196 def grain @grain end |
#to ⇒ Time
Returns the end time
193 194 195 |
# File 'src/services/duckling_service.rb', line 193 def to @to end |
Instance Method Details
#interval? ⇒ true
Is this an interval of values?
209 210 211 |
# File 'src/services/duckling_service.rb', line 209 def interval? true end |
#to_time_using_from ⇒ TimeOption
Convert to a time option using the start time of the interval
216 217 218 219 220 |
# File 'src/services/duckling_service.rb', line 216 def to_time_using_from return unless from TimeOption.new(from, grain) end |
#to_time_using_to ⇒ TimeOption
Convert to a time option using the end time of the interval
225 226 227 228 229 |
# File 'src/services/duckling_service.rb', line 225 def to_time_using_to return unless to TimeOption.new(to, grain) end |
#value? ⇒ false
Is this a single value, or an interval of values?
202 203 204 |
# File 'src/services/duckling_service.rb', line 202 def value? false end |