padrino-routing 0.1.5 → 0.2.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.2.0
@@ -4,9 +4,8 @@ if defined?(Padrino::Application) # Extends padrino application if being used
4
4
  # Makes the routes defined in the block and in the Modules given
5
5
  # in `extensions` available to the application
6
6
  def controllers_with_namespaces(*namespace, &block)
7
- must_use_namespaces = namespace.size == 1 and namespace.first.is_a?(Symbol)
7
+ must_use_namespaces = namespace.size == 1 && namespace.first.is_a?(Symbol)
8
8
  return controllers_without_namespaces(*namespace, &block) unless must_use_namespaces
9
- self.reset_routes! if reload?
10
9
  namespace(namespace.first) { instance_eval(&block) } if block_given?
11
10
  end
12
11
 
@@ -10,9 +10,11 @@ module Padrino
10
10
  end
11
11
 
12
12
  # Used to define the url mapping to the supplied alias
13
+ # Appends the application name to front of route if necessary
13
14
  # NamedRoute.new(@app, :account).to('/account/path')
14
15
  def to(path)
15
- @app.named_paths[@names.unshift(@app.app_name.to_sym)] = path
16
+ @names.unshift(@app.app_name.to_sym) unless @names.first == @app.app_name.to_sym
17
+ @app.named_paths[@names] = path
16
18
  end
17
19
 
18
20
  # Used to define the url mappings for child aliases within a namespace
@@ -18,8 +18,8 @@ module Padrino
18
18
  # map(:accounts).to('/accounts/url')
19
19
  # map(:admin, :show).to('/admin/show/:id')
20
20
  # map(:admin) { |namespace| namespace.map(:show).to('/admin/show/:id') }
21
- def map(*args, &block)
22
- named_router = Padrino::Routing::NamedRoute.new(self, *args)
21
+ def map(*names, &block)
22
+ named_router = Padrino::Routing::NamedRoute.new(self, *names)
23
23
  block_given? ? block.call(named_router) : named_router
24
24
  end
25
25
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{padrino-routing}
8
- s.version = "0.1.5"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-routing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team