Sha256: e8238b31420b638384a1cf8e9c4ecbbcb4372549b238919bfdf9738dab4387da
Contents?: true
Size: 758 Bytes
Versions: 27
Compression:
Stored size: 758 Bytes
Contents
module Sequel class << self def fos(odbc_name,opts={}) db = Sequel.odbc(odbc_name,opts) db.extend(Sequel::Pervasive::DatabaseMethods) db end def fos_dbr(opts={}) db = Sequel.mysql(opts) db.extend(MySql::Pervasive::DatabaseMethods) # require the dbr libs Dir["#{File.dirname(__FILE__)}/../dbr_models/*.rb"].each{|f| load f} db end # sets the db to all sequel models def set_db(db) Sequel::Model.find_children.each { |klass| klass.to_s.constantize.db=db } end # take a fos_id like: "SEMJ.0.15.40210.1342" and convert to ["SEMJ", 0, 15, 40210, 1342] def fos_id_to_lookup_key(fos_id) fos_id.split('-').collect{|v| v.match(/\d+/) ? v.to_i : v} end end end
Version data entries
27 entries across 27 versions & 1 rubygems