flame 4.3.3 → 4.3.4
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.
- checksums.yaml +4 -4
- data/lib/flame/controller.rb +6 -0
- data/lib/flame/dispatcher.rb +2 -2
- data/lib/flame/route.rb +1 -1
- data/lib/flame/validators.rb +4 -4
- data/lib/flame/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e934a6b8356c082c5adbf9010ebcf19c5cfdc01
|
4
|
+
data.tar.gz: 16ead4865ce5d9265aaf7fc7d38de401b034b816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef6fe5a9eb6e074ad671ee088b18966bdf894002bcb6afe00f814d21772f77477bc04cdff2611d84cc94ac22acfddb168c4bc294d07912a5d675de552df5d9b5
|
7
|
+
data.tar.gz: c26c8020c593d48f8bf185833abc0602951c67ee1a0fcbe4ae874fa80d6af874fede4fd29a6ff37f2d94a2e6bb616d92caa3f4b4d7f29d1a3e8c09e6383df782
|
data/lib/flame/controller.rb
CHANGED
@@ -18,6 +18,12 @@ module Flame
|
|
18
18
|
@dispatcher.path_to(*args)
|
19
19
|
end
|
20
20
|
|
21
|
+
## Build a URI to the given controller and action, or path
|
22
|
+
def url_to(*args)
|
23
|
+
path = args.first.is_a?(String) ? args.first : path_to(*args)
|
24
|
+
"#{request.scheme}://#{request.host}#{path}"
|
25
|
+
end
|
26
|
+
|
21
27
|
## Redirect for response
|
22
28
|
## @overload redirect(path)
|
23
29
|
## Redirect to the string path
|
data/lib/flame/dispatcher.rb
CHANGED
@@ -82,7 +82,7 @@ module Flame
|
|
82
82
|
response[Rack::CONTENT_TYPE] = Rack::Mime.mime_type(ext)
|
83
83
|
end
|
84
84
|
|
85
|
-
##
|
85
|
+
## Build a path to the given controller and action, with any expected params
|
86
86
|
##
|
87
87
|
## @param ctrl [Flame::Controller] class of controller
|
88
88
|
## @param action [Symbol] method of controller
|
@@ -92,7 +92,7 @@ module Flame
|
|
92
92
|
## path_to ArticlesController, :show, id: 2 # => "/articles/show/2"
|
93
93
|
def path_to(ctrl, action = :index, args = {})
|
94
94
|
route = @app.class.router.find_route(controller: ctrl, action: action)
|
95
|
-
|
95
|
+
raise Errors::RouteNotFoundError.new(ctrl, action) unless route
|
96
96
|
path = route.assign_arguments(args)
|
97
97
|
path.empty? ? '/' : path
|
98
98
|
end
|
data/lib/flame/route.rb
CHANGED
data/lib/flame/validators.rb
CHANGED
@@ -45,7 +45,7 @@ module Flame
|
|
45
45
|
## Subtraction action args from path args
|
46
46
|
extra_path_args = @path_args - @action_args[:all]
|
47
47
|
return true if extra_path_args.empty?
|
48
|
-
|
48
|
+
raise Errors::RouterError::ExtraPathArgumentsError.new(
|
49
49
|
@ctrl, @action, @path, extra_path_args
|
50
50
|
)
|
51
51
|
end
|
@@ -54,7 +54,7 @@ module Flame
|
|
54
54
|
## Subtraction path args from action required args
|
55
55
|
extra_action_args = @action_args[:req] - @path_args
|
56
56
|
return true if extra_action_args.empty?
|
57
|
-
|
57
|
+
raise Errors::RouterError::ExtraActionArgumentsError.new(
|
58
58
|
@ctrl, @action, @path, extra_action_args
|
59
59
|
)
|
60
60
|
end
|
@@ -80,7 +80,7 @@ module Flame
|
|
80
80
|
def no_extra_routes_actions?
|
81
81
|
extra_routes_actions = @routes_actions - @ctrl_actions[:public]
|
82
82
|
return true if extra_routes_actions.empty?
|
83
|
-
|
83
|
+
raise Errors::RouterError::ExtraRoutesActionsError.new(
|
84
84
|
@ctrl, extra_routes_actions
|
85
85
|
)
|
86
86
|
end
|
@@ -88,7 +88,7 @@ module Flame
|
|
88
88
|
def no_extra_controller_actions?
|
89
89
|
extra_ctrl_actions = @ctrl_actions[:public] - @routes_actions
|
90
90
|
return true if extra_ctrl_actions.empty?
|
91
|
-
|
91
|
+
raise Errors::RouterError::ExtraControllerActionsError.new(
|
92
92
|
@ctrl, extra_ctrl_actions
|
93
93
|
)
|
94
94
|
end
|
data/lib/flame/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flame
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|