Sha256: 649f5827e3d6143b974c6a6a3aef46e5660efbcf1310c293e7bc85984f17d100
Contents?: true
Size: 833 Bytes
Versions: 2
Compression:
Stored size: 833 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 dbr_lib_dir = File.join(File.dirname(__FILE__),'..','lib','dbr_fos_models') Dir.glob(File.join(dbr_lib_dir , '*.rb')).each{|f| require 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fossil-0.5.5 | lib/sequel/core_patch.rb |
fossil-0.5.3 | lib/sequel/core_patch.rb |