Sha256: 694a1e5c2175e416cbaf55f041827048c8f6fa8c31b598c6729a84e5daf047ae

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 Bytes

Contents

require 'search_lingo/parsers/date_parser'
require 'forwardable'

module SearchLingo
  module Parsers
    class LTEDateParser < DateParser
      extend Forwardable

      def call(token)
        token.match /\A#{prefix}-(?<date>#{US_DATE})\z/ do |m|
          date = parse m[:date]
          if date
            [:where, "#{quote_table_name table}.#{quote_column_name column} <= ?", date]
          end
        end
      end

      def post_initialize(connection:, **)
        @connection = connection
      end

      def_delegators :@connection, :quote_column_name, :quote_table_name
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
search_lingo-1.0.0 lib/search_lingo/parsers/lte_date_parser.rb
search_lingo-1.0.0.beta3 lib/search_lingo/parsers/lte_date_parser.rb
search_lingo-1.0.0.beta2 lib/search_lingo/parsers/lte_date_parser.rb