Sha256: cb54207aa4743249df1a5b724a590ac6111adc5c10bc5edbb285960164615944
Contents?: true
Size: 436 Bytes
Versions: 1
Compression:
Stored size: 436 Bytes
Contents
require 'search_lingo/parsers/date_parser' module SearchLingo module Parsers # :nodoc: class DateRangeParser < DateParser def call(token) token.match /\A#{prefix}(?<min>#{US_DATE})-(?<max>#{US_DATE})\z/ do |m| min = parse m[:min] max = parse m[:max], relative_to: min.next_year if min [:where, { table => { column => min..max } }] if min && max end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search_lingo-1.0.2 | lib/search_lingo/parsers/date_range_parser.rb |