subrails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,8 +3,12 @@ require 'action_dispatch/routing/mapper'
3
3
  module ActionDispatch::Routing::Mapper::Subdomains
4
4
 
5
5
  def subdomain *subdomains, &block
6
- subdomain = subdomains.length == 1 ? subdomains.first.to_s : /#{subdomains.join('|')}/
7
- constraints(:subdomain => subdomain, &block)
6
+ subdomains = subdomains.map(&:to_s)
7
+ if subdomains.length == 1
8
+ constraints(:subdomain => subdomains.first, &block)
9
+ else
10
+ constraints(lambda{ |req| subdomains.include? req.subdomain.to_s }, &block)
11
+ end
8
12
  end
9
13
 
10
14
  def redirect_to_subdomain subdomain, path='/', &block
@@ -1,3 +1,3 @@
1
1
  module Subrails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subrails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jared Grippe