Get sinatra environment from within instance method
puts Sinatra::Application.environment
#=> production (or test, development)
I would use Sinatra::Base.development?
or Sinatra::Base.production?
since that is where the methods are coming from.
self.class.development?
should actually work. These all work for me on Sinatra 1.3.1:
class Main < Sinatra::Base
get '/' do
puts Main.development?
puts self.class.development?
puts settings.development?
puts settings.environment == :development
end
end