Method: WordNet::Lexicon#initialize
- Defined in:
- lib/wordnet/lexicon.rb
#initialize(*args) ⇒ Lexicon
Create a new WordNet::Lexicon object that will use the database connection specified by the given dbconfig.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/wordnet/lexicon.rb', line 153 def initialize( *args ) if args.empty? self.initialize_with_defaultdb( args.shift ) elsif args.first.is_a?( String ) self.initialize_with_uri( *args ) else self.initialize_with_opthash( args.shift ) end @db.sql_log_level = :debug WordNet::Model.db = @db WordNet::Model.descendents.each do |subclass| self.log.debug "Switching DB for %p to %p" % [ subclass, @db ] subclass.dataset = @db[ subclass.table_name ] end # Add the logger device after it's been loaded @db.logger = Loggability[ self.class ] end |