lib/xapian_db/config.rb in xapian_db-0.5.7 vs lib/xapian_db/config.rb in xapian_db-0.5.8

- old
+ new

@@ -10,10 +10,12 @@ # config.database "db/xapian_db" # end # @author Gernot Kogler class Config + include XapianDb::Utilities + # --------------------------------------------------------------------------------- # Singleton methods # --------------------------------------------------------------------------------- class << self @@ -46,11 +48,10 @@ # --------------------------------------------------------------------------------- # DSL methods # --------------------------------------------------------------------------------- - # attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_stemmer, :_stopper # Set the global database to use # @param [String] path The path to the database. Either apply a file sytem path or :memory # for an in memory database @@ -106,19 +107,12 @@ # XapianDb::Config.setup do |config| # config.language :de # end # see {LANGUAGE_MAP} for supported languages def language(lang) - key = lang.to_sym - @_stemmer = XapianDb::Repositories::Stemmer.stemmer_for key - key == :none ? @_stopper = nil : @_stopper = XapianDb::Repositories::Stopper.stopper_for(key) - end - - private - - # TODO: move this to a helper module - def camelize(string) - string.split(/[^a-z0-9]/i).map{|w| w.capitalize}.join + lang ||= :none + @_stemmer = XapianDb::Repositories::Stemmer.stemmer_for lang + @_stopper = lang == :none ? nil : XapianDb::Repositories::Stopper.stopper_for(lang) end end end \ No newline at end of file