Module Sinatra::Options
In: lib/sinatra/options.rb

Methods

External Aliases

use_mutex -> use_mutex?

Public Instance methods

[Source]

    # File lib/sinatra/options.rb, line 36
36:     def log_file
37:       # TODO find a better way that this
38:       if File.basename($0, '.rb') == 'rake_test_loader'  # hack to satisfy rake
39:         '%s.log' % environment
40:       else
41:         File.dirname($0) + ('/%s.log' % environment)
42:       end
43:     end

[Source]

    # File lib/sinatra/options.rb, line 14
14:     def parse!(args)
15:       return if @environment == :test
16:       OptionParser.new do |opts|
17:         opts.on '-p port', '--port port', 'Set the port (default is 4567)' do |port|
18:           @port = port
19:         end
20:         opts.on '-e environment', 'Set the environment (default if development)' do |env|
21:           @environment = env.intern
22:         end
23:         opts.on '-c', '--console', 'Run in console mode' do
24:           @console = true
25:         end
26:         opts.on '-h', '--help', '-?', 'Show this message' do
27:           puts opts
28:           exit!
29:         end
30:         opts.on '-X', '--mutex', 'Use mutex lock when attending events' do
31:           @use_mutex = true
32:         end
33:       end.parse!(ARGV)
34:     end

[Source]

    # File lib/sinatra/options.rb, line 45
45:     def set_environment(env)
46:       @environment = env
47:     end

[Validate]