Sha256: b861a52f0569bc3cab8b123e9bab40624c6a751c990559b78bf8bfc0beb39aa1

Contents?: true

Size: 530 Bytes

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
fossil-0.5.2 lib/sequel/core_patch.rb
fossil-0.5.1 lib/sequel/core_patch.rb
fossil-0.5.0 lib/sequel/core_patch.rb
fossil-0.4.26 lib/sequel/core_patch.rb
fossil-0.4.25 lib/sequel/core_patch.rb