Class: Rack::Request

Inherits:
Object show all
Defined in:
lib/utopia/extensions/rack.rb,
lib/utopia/middleware/localization.rb,
lib/utopia/middleware/controller.rb

Overview

This file is part of the “Utopia Framework” project, and is released under the MIT license. Copyright 2010 Samuel Williams. All rights reserved. See <utopia.rb> for licensing details.

Instance Method Summary collapse

Instance Method Details

#all_localesObject



14
15
16
# File 'lib/utopia/middleware/localization.rb', line 14

def all_locales
	localization.all_locales
end

#controller(&block) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/utopia/middleware/controller.rb', line 10

def controller(&block)
	if block_given?
		env["utopia.controller"].instance_eval(&block)
	else
		env["utopia.controller"]
	end
end

#current_localeObject



10
11
12
# File 'lib/utopia/middleware/localization.rb', line 10

def current_locale
	env["utopia.current_locale"]
end

#localizationObject



18
19
20
# File 'lib/utopia/middleware/localization.rb', line 18

def localization
	env["utopia.localization"]
end

#url_with_path(path = "") ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/utopia/extensions/rack.rb', line 6

def url_with_path(path = "")
	url = scheme + "://"
	url << host

	if scheme == "https" && port != 443 || scheme == "http" && port != 80
		url << ":#{port}"
	end

	url << path
end