Sha256: 5a50d06c440125fca606300f0814b75f65dbf15f77333530f2d1b32fd7e0333e

Contents?: true

Size: 530 Bytes

Versions: 4

Compression:

Stored size: 530 Bytes

Contents

module Sequel

  class << self
    def fos(odbc_name,opts={})
      db = Sequel.odbc(odbc_name,opts)
      db.extend(Sequel::Pervasive::DatabaseMethods)
      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

4 entries across 4 versions & 1 rubygems

Version Path
fossil-0.4.24 lib/sequel/core_patch.rb
fossil-0.4.23 lib/sequel/core_patch.rb
fossil-0.4.22 lib/sequel/core_patch.rb
fossil-0.4.20 lib/sequel/core_patch.rb