module Toller::Filters::Mutators::Time

Time filter mutator

Public Instance Methods

call(value) click to toggle source
# File lib/toller/filters/mutators/time.rb, line 12
def call(value)
  range_dots = inclusive_or_exclusive_range(value)

  return value if range_dots.blank?

  range(value, range_dots)
end
inclusive_or_exclusive_range(value) click to toggle source
# File lib/toller/filters/mutators/time.rb, line 24
def inclusive_or_exclusive_range(value)
  return '...' if value.include?('...')
  return '..' if value.include?('..')

  nil
end
range(value, dots) click to toggle source
# File lib/toller/filters/mutators/time.rb, line 20
def range(value, dots)
  Range.new(*value.split(dots))
end