Sha256: 6ea3b0dfeb6cd56de4823780c3e6404e1e9a09ce995620e7c7f07e5d6ee7d203

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 GTEDateParser < 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/gte_date_parser.rb
search_lingo-1.0.0.beta3 lib/search_lingo/parsers/gte_date_parser.rb
search_lingo-1.0.0.beta2 lib/search_lingo/parsers/gte_date_parser.rb