2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/vex/action_controller/verify_hostname.rb', line 2
def verify_hostname(matcher=nil, &block)
matcher ||= Proc.new
before_filter do |controller|
host = controller.request.host
case matcher
when String
next if matcher == host
when Regexp
next if matcher.match(host)
when Proc
next if matcher.call(host)
end
msg = "Not on #{host}"
msg += "; should have matched #{matcher.inspect}" if App.development?
controller.error 404, msg + "\n"
end
end
|