Sha256: f3447a5ce12d01540fb19e36b4b74d95b5383692179ad5c0d0b378ee74d6375b
Contents?: true
Size: 426 Bytes
Versions: 4
Compression:
Stored size: 426 Bytes
Contents
require 'search_lingo/parsers/date_parser' module SearchLingo module Parsers 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
4 entries across 4 versions & 1 rubygems