examples/complex.rb in search_lingo-1.0.1 vs examples/complex.rb in search_lingo-1.0.2

- old
+ new

@@ -1,15 +1,15 @@ -class Job < ActiveRecord::Base +class Job < ActiveRecord::Base # :nodoc: # Assume this model has attributes: :id, :date, :name end -class Receipt < ActiveRecord::Base +class Receipt < ActiveRecord::Base # :nodoc: # Assume this model has attributes: :id, :check_no, :check_date, :post_date, :amount end -module Parsers - class IdParser +module Parsers # :nodoc: + class IdParser # :nodoc: def initialize(table) @table = table end def call(token) @@ -18,11 +18,11 @@ end end end end -class JobSearch < AbstractSearch +class JobSearch < SearchLingo::AbstractSearch # :nodoc: parser Parsers::IdParser.new Job.table_name parser SearchLingo::Parsers::DateParser.new Job.table_name, :date parser SearchLingo::Parsers::DateRangeParser.new Job.table_name, @@ -33,10 +33,10 @@ def default_parse(token) [:where, 'jobs.name LIKE ?', "%#{token}%"] end end -class ReceiptSearch < AbstractSearch +class ReceiptSearch < SearchLingo::AbstractSearch # :nodoc: parser Parsers::IdParser.new Receipt.table_name parser SearchLingo::Parsers::DateParser.new Receipt.table_name, :check_date parser SearchLingo::Parsers::DateRangeParser.new Receipt.table_name,