Class: DucklingService::IntervalOption

Inherits:
Struct
  • Object
show all
Defined in:
src/services/duckling_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fromTime

Returns the start time

Returns:

  • (Time)

    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

Returns:

  • ('year' | 'month' | 'day' | 'hour' | 'minute' | 'second')

    the time grain



196
197
198
# File 'src/services/duckling_service.rb', line 196

def grain
  @grain
end

#toTime

Returns the end time

Returns:

  • (Time)

    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?

Returns:

  • (true)


209
210
211
# File 'src/services/duckling_service.rb', line 209

def interval?
  true
end

#to_time_using_fromTimeOption

Convert to a time option using the start time of the interval

Returns:



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_toTimeOption

Convert to a time option using the end time of the interval

Returns:



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?

Returns:

  • (false)


202
203
204
# File 'src/services/duckling_service.rb', line 202

def value?
  false
end