sinatra-named-routes-subdomains 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,8 +40,8 @@ module Sinatra
40
40
  end
41
41
 
42
42
  # Maps a path to name.
43
- def map(name, path)
44
- NamedRoutes.routes[name] = Route.new path
43
+ def map(name, path, params = {})
44
+ NamedRoutes.routes[name] = Route.new path, params
45
45
  end
46
46
 
47
47
  alias :bind :map
@@ -3,12 +3,13 @@ module Sinatra
3
3
  class Route
4
4
  attr_reader :source
5
5
 
6
- def initialize(route)
6
+ def initialize(route, params = {})
7
7
  route = route.source if route.is_a? Regexp
8
8
 
9
9
  @source = route
10
10
  @input = StringScanner.new(route)
11
11
  @output = []
12
+ @params = params
12
13
 
13
14
  parse
14
15
  end
@@ -17,6 +18,8 @@ module Sinatra
17
18
  path = []
18
19
  params = {} if params.nil?
19
20
 
21
+ params = @params.merge( params )
22
+
20
23
  @output.each_index do |index|
21
24
  item = @output[index]
22
25
  next_item = @output.fetch(index + 1, nil)
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module BlueRoutes
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-named-routes-subdomains
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-02 00:00:00.000000000 Z
12
+ date: 2013-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra