class Rack::WebProfiler::Model

Model

Public Class Methods

clean!() click to toggle source

Remove the database content.

# File lib/rack/web_profiler/model.rb, line 22
def clean!
  return unless ::File.exist?(db_file_path)

  CollectionRecord.truncate
end
database() click to toggle source

Get the WebProfiler database.

@return [Sequel::SQLite::Database]

# File lib/rack/web_profiler/model.rb, line 11
def database
  @db ||= Sequel.connect("sqlite://#{db_file_path}", {
    single_threaded: true,
    # timeout: 5000,
    # # single_threaded: true, # = mieux
    # pool_timeout: 5000,
    # max_connections: 1,
  })
end

Private Class Methods

db_file_path() click to toggle source

Returns the db file path.

@return [String]

# File lib/rack/web_profiler/model.rb, line 33
def db_file_path
  @db_file_path ||= ::File.join(WebProfiler.config.tmp_dir, "rack-webprofiler.db")
end