lib/pg_search/features/dmetaphone.rb in pg_search-0.5.4 vs lib/pg_search/features/dmetaphone.rb in pg_search-0.5.5

- old
+ new

@@ -6,26 +6,34 @@ options = (options || {}).merge(:dictionary => 'simple') @tsearch = TSearch.new(query, options, columns, model, dmetaphone_normalizer) end def conditions - @tsearch.conditions + tsearch.conditions end def rank - @tsearch.rank + tsearch.rank end + private + + attr_reader :tsearch + # Decorates a normalizer with dmetaphone processing. class Normalizer def initialize(normalizer_to_wrap) - @decorated_normalizer = normalizer_to_wrap + @normalizer_to_wrap = normalizer_to_wrap end def add_normalization(original_sql) - otherwise_normalized_sql = @decorated_normalizer.add_normalization(original_sql) + otherwise_normalized_sql = normalizer_to_wrap.add_normalization(original_sql) "pg_search_dmetaphone(#{otherwise_normalized_sql})" end + + private + + attr_reader :normalizer_to_wrap end end end end