Module: Mojito::Controllers::Runtime::VirtualHost

Defined in:
lib/mojito/controllers/runtime/virtual_host.rb

Instance Method Summary collapse

Instance Method Details

#HOST(pattern) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mojito/controllers/runtime/virtual_host.rb', line 7

def HOST(pattern)
	proc do
		case pattern
		when String
			/#{pattern.gsub('**', '[^:]+').gsub('*', '[^:.]+')}/ === request.host_with_port
		when Array
			pattern.any? {|p| /#{p.gsub('**', '[^:]+').gsub('*', '[^:.]+')}/ === request.host_with_port }
		when Regexp
			pattern === request.host_with_port
		end
	end
end