examples/complex.rb in search_lingo-2.0.0.pre2 vs examples/complex.rb in search_lingo-2.0.0.pre3

- old
+ new

@@ -1,20 +1,30 @@ +# frozen-string-literal: true + class Job < ActiveRecord::Base # :nodoc: - # Assume this model has attributes: :id, :date, :name + # Attributes: + # :id + # :date + # :name end class Receipt < ActiveRecord::Base # :nodoc: - # Assume this model has attributes: :id, :check_no, :check_date, :post_date, :amount + # Attributes: + # :id + # :check_no + # :check_date + # :post_date + # :amount end module Parsers # :nodoc: class IdParser # :nodoc: def initialize(table) @table = table end def call(token, chain) - token.match /\Aid:\s*([[:digit:]]+)\z/ do |m| + token.match(/\Aid:\s*([[:digit:]]+)\z/) do |m| chain.where @table => { id: m[1] } end end end end