Class: Cannon::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cannon/config.rb

Defined Under Namespace

Classes: Cookies

Constant Summary collapse

DEFAULT_MIDDLEWARE =
%w{RequestLogger Files Cookies Router ContentType}
LOG_LEVELS =
{
  unknown: Logger::UNKNOWN,
  fatal: Logger::FATAL,
  error: Logger::ERROR,
  warn: Logger::WARN,
  info: Logger::INFO,
  debug: Logger::DEBUG,
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cannon/config.rb', line 19

def initialize
  self.ip_address = '127.0.0.1'
  self.port = 5030
  self.middleware = DEFAULT_MIDDLEWARE
  self.public_path = 'public'
  self.view_path = 'views'
  self.reload_on_request = false
  self.benchmark_requests = true
  @log_level = :info
  self.logger = Logger.new(STDOUT)
end

Instance Attribute Details

#benchmark_requestsObject

Returns the value of attribute benchmark_requests.



5
6
7
# File 'lib/cannon/config.rb', line 5

def benchmark_requests
  @benchmark_requests
end

#ip_addressObject

Returns the value of attribute ip_address.



5
6
7
# File 'lib/cannon/config.rb', line 5

def ip_address
  @ip_address
end

#log_levelObject

Returns the value of attribute log_level.



6
7
8
# File 'lib/cannon/config.rb', line 6

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



6
7
8
# File 'lib/cannon/config.rb', line 6

def logger
  @logger
end

#middlewareObject

Returns the value of attribute middleware.



5
6
7
# File 'lib/cannon/config.rb', line 5

def middleware
  @middleware
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/cannon/config.rb', line 5

def port
  @port
end

#public_pathObject

Returns the value of attribute public_path.



5
6
7
# File 'lib/cannon/config.rb', line 5

def public_path
  @public_path
end

#reload_on_requestObject

Returns the value of attribute reload_on_request.



5
6
7
# File 'lib/cannon/config.rb', line 5

def reload_on_request
  @reload_on_request
end

#view_pathObject

Returns the value of attribute view_path.



5
6
7
# File 'lib/cannon/config.rb', line 5

def view_path
  @view_path
end

Instance Method Details

#cookiesObject



46
47
48
# File 'lib/cannon/config.rb', line 46

def cookies
  @cookies ||= Cookies.new
end