Sha256: d86d6afe3eda7e5f12fefc9a171ea975110aa6a1c959030d628c56d4743354a1

Contents?: true

Size: 453 Bytes

Versions: 3

Compression:

Stored size: 453 Bytes

Contents

require 'orange-core/middleware/base'
module Orange::Middleware
  
  class Database < Base
    def init(*args)
      orange.mixin Orange::Mixins::DBLoader
    end
    def packet_call(packet)
      db = packet['orange.globals']['database'] || 'sqlite3::memory:'
      orange.load_db!(db)
      pass packet
    end
  end
  
end

module Orange::Mixins::DBLoader
  def load_db!(url)
    DataMapper.setup(:default, url)
    DataMapper.auto_upgrade!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
orange-0.1.0 lib/orange-core/middleware/database.rb
orange-0.0.15 lib/orange-core/middleware/database.rb
orange-0.0.14 lib/orange-core/middleware/database.rb