Skip to content

gristmill/sinatra-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinatra Env

A few methods for inquiring about the Sinatra/Rack environment a`la Rails.

Sinatra.env
# => "production"

Sinatra.env.production?
# => true

Sinatra.env.development?
# => false

Usage

app.rb

require 'bundler/setup'
require 'sinatra'
require 'sinatra-env'

# ./database.yml
# production:
#   database: mysql://root@localhost/database_name
# development:
#   database: sqlite://db/database.sqlite
database = YAML.load_file("database.yml")[Sinatra.env]

get '/' do
  if Sinatra.env.development?
    # do something
  else
    # do something else
  end
end

License

MIT license:

http://www.opensource.org/licenses/MIT

Releases

No releases published

Packages

No packages published

Languages