rails_templated_urls 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5589bbdb5208706c2d1f25d1ae1f4da922abc40e
|
4
|
+
data.tar.gz: e9d74cdc8550befeb68635c3c13cc25ca6acbe55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fde8250e5b2dc486d4bf3d05c90fd8a3a06bd6eaf0c52107b623319ae6f9e4d493aff58b5215b1a344124c653bebc012274fbc4b52117bc4539f54e544a6e20c
|
7
|
+
data.tar.gz: 4aa634f68b097e8dce221310cc0fdba2adfdfe6ad0f34d561f6708eaec090d9ccd442bea888484063cfedbdff03e491b1d138edcf4b3e5b02c5acb8a5797cf9a
|
@@ -5,15 +5,16 @@ module RailsTemplatedUrls
|
|
5
5
|
class Builder
|
6
6
|
extend Forwardable
|
7
7
|
|
8
|
-
def initialize(name, params, routes)
|
8
|
+
def initialize(name, params, url_helpers, routes)
|
9
9
|
@name = name
|
10
10
|
@params = params
|
11
|
+
@url_helpers = url_helpers
|
11
12
|
@routes = routes
|
12
13
|
|
13
14
|
check_route
|
14
15
|
end
|
15
16
|
|
16
|
-
def_delegators :@routes, :named_routes
|
17
|
+
def_delegators :@routes, :named_routes
|
17
18
|
|
18
19
|
def url
|
19
20
|
build(:url)
|
@@ -46,8 +47,8 @@ module RailsTemplatedUrls
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def build(strategy)
|
49
|
-
url = url_helpers.public_send("#{@name}_#{strategy}",
|
50
|
-
|
50
|
+
url = @url_helpers.public_send("#{@name}_#{strategy}",
|
51
|
+
*required_parts_expressions)
|
51
52
|
|
52
53
|
"#{CGI.unescape(url)}#{params_expression}"
|
53
54
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module RailsTemplatedUrls
|
2
2
|
module ViewHelpers
|
3
3
|
def templated_url(name, *params)
|
4
|
-
Builder.new(name, params, Rails.application.routes).url
|
4
|
+
Builder.new(name, params, self, Rails.application.routes).url
|
5
5
|
end
|
6
6
|
|
7
7
|
def templated_path(name, *params)
|
8
|
-
Builder.new(name, params, Rails.application.routes).path
|
8
|
+
Builder.new(name, params, self, Rails.application.routes).path
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_templated_urls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lenon Marcel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|