Class Capcode::Configuration
In: lib/capcode/configuration.rb
Parent: Object

Methods

get   options   set  

Public Class methods

[Source]

    # File lib/capcode/configuration.rb, line 61
61:       def get( key = nil )
62:         if key.nil?
63:           config
64:         else
65:           config[key] || nil
66:         end
67:       end

[Source]

    # File lib/capcode/configuration.rb, line 69
69:       def options
70:         @options ||= {}
71:       end

Set global configuration options

Options :

  • :port = Listen port (default: 3000)
  • :host = Listen host (default: 0.0.0.0)
  • :server = Server type (webrick, mongrel or thin)
  • :log = Output logfile (default: STDOUT)
  • :session = Session parameters. See Rack::Session for more informations
  • :pid = PID file (default: $0.pid)
  • :daemonize = Daemonize application (default: false)
  • :db_config = database configuration file (default: database.yml)
  • :static = Static directory (default: the working directory)
  • :root = Root directory (default: directory of the main.rb) — This is also the working directory !
  • :verbose = run in verbose mode
  • :auth = HTTP Basic Authentication options

It can exist specifics options depending on a renderer, a helper, …

Example :

  module Capcode
    set :erb, "/path/to/erb/files"
    ...
  end

[Source]

    # File lib/capcode/configuration.rb, line 52
52:       def set( key, value, opts = {} )
53:         if Hash === value
54:           opts = value
55:           value = nil
56:         end
57:         config[key] = value
58:         options[key] = opts
59:       end

[Validate]