lib/mongoid_search.rb in mongoid_search-0.3.4 vs lib/mongoid_search.rb in mongoid_search-0.3.5
- old
+ new
@@ -1,12 +1,8 @@
-# encoding: utf-8
-
require 'mongoid_search/mongoid_search'
-if defined?(Rails)
- require 'mongoid_search/railtie'
-end
+require 'mongoid_search/railtie' if defined?(Rails)
module Mongoid::Search
## Default matching type. Match :any or :all searched keywords
mattr_accessor :match
@@match = :any
@@ -23,11 +19,11 @@
mattr_accessor :stem_keywords
@@stem_keywords = false
## Stem procedure
mattr_accessor :stem_proc
- @@stem_proc = Proc.new { |word| word.stem }
+ @@stem_proc = proc { |word| word.stem }
## Words to ignore
mattr_accessor :ignore_list
@@ignore_list = []
@@ -43,19 +39,19 @@
## Regex to search
mattr_accessor :regex
## Match partial words on both sides (slower)
- @@regex = Proc.new { |query| /#{query}/ }
+ @@regex = proc { |query| /#{query}/ }
## Match partial words on the beginning or in the end (slightly faster)
# @@regex = Proc.new { |query| /^#{query}/ }
# @@regex = Proc.new { |query| /#{query}$/ }
# Ligatures to be replaced
# http://en.wikipedia.org/wiki/Typographic_ligature
mattr_accessor :ligatures
- @@ligatures = { "œ"=>"oe", "æ"=>"ae" }
+ @@ligatures = { 'œ' => 'oe', 'æ' => 'ae' }
# Minimum word size. Words smaller than it won't be indexed
mattr_accessor :minimum_word_size
@@minimum_word_size = 2