flame 4.0.5 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flame/dispatcher.rb +9 -3
- data/lib/flame/render.rb +2 -2
- data/lib/flame/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3eff2ff95d66cad8d31d30b8938ee7f7936726
|
4
|
+
data.tar.gz: c8b3793fab9614b8c710f71e01f22f2c25dde926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98e65d7b60f888c271b83e987b4cbf5c56a800f0fcf30678d29f1df5546d835194728656c9bcf0808ded1e278e897a116f90ead91899f05cde915cb1d053cff8
|
7
|
+
data.tar.gz: 5d7e63b49ad424fa33d3319daaa585e038a0942cc633489a3d139f0557b59d035f1f4787b4459375713a42f2ac2e8791de020d4f05c3ff2165de4c7484c25bb6
|
data/lib/flame/dispatcher.rb
CHANGED
@@ -86,7 +86,7 @@ module Flame
|
|
86
86
|
## path_to ArticlesController, :show, id: 2 # => "/articles/show/2"
|
87
87
|
def path_to(ctrl, action = :index, args = {})
|
88
88
|
route = @app.class.router.find_route(controller: ctrl, action: action)
|
89
|
-
fail RouteNotFoundError.new(ctrl, action) unless route
|
89
|
+
fail Errors::RouteNotFoundError.new(ctrl, action) unless route
|
90
90
|
path = route.assign_arguments(args)
|
91
91
|
path.empty? ? '/' : path
|
92
92
|
end
|
@@ -152,7 +152,7 @@ module Flame
|
|
152
152
|
status 200
|
153
153
|
params.merge!(route.arguments(request.path_parts))
|
154
154
|
# route.execute(self)
|
155
|
-
|
155
|
+
route_exec(route)
|
156
156
|
rescue => exception
|
157
157
|
# p 'rescue from dispatcher'
|
158
158
|
dump_error(exception) unless @error_message
|
@@ -173,7 +173,13 @@ module Flame
|
|
173
173
|
## or it's `not_found` method not defined
|
174
174
|
return halt unless route && route[:controller].method_defined?(:not_found)
|
175
175
|
## Execute `not_found` method for the founded route
|
176
|
-
route
|
176
|
+
route_exec(route, :not_found)
|
177
|
+
end
|
178
|
+
|
179
|
+
## Create controller object and execute method
|
180
|
+
def route_exec(route, method = nil)
|
181
|
+
method ||= route[:action]
|
182
|
+
route[:controller].new(self).send(:execute, method)
|
177
183
|
end
|
178
184
|
end
|
179
185
|
end
|
data/lib/flame/render.rb
CHANGED
@@ -41,7 +41,7 @@ module Flame
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
using GorillaPatch::
|
44
|
+
using GorillaPatch::ModuleExt
|
45
45
|
|
46
46
|
## Compile file with Tilt engine
|
47
47
|
## @param filename [String] filename
|
@@ -64,7 +64,7 @@ module Flame
|
|
64
64
|
|
65
65
|
## Find possible directories for the controller
|
66
66
|
def controller_dirs
|
67
|
-
controller_dir_parts = @ctrl.class.
|
67
|
+
controller_dir_parts = @ctrl.class.underscore.split('/').map do |part|
|
68
68
|
(part.split('_') - %w(controller controllers ctrl)).join('_')
|
69
69
|
end
|
70
70
|
controller_dir = controller_dir_parts.join('/')
|
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.0.
|
4
|
+
version: 4.0.6
|
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-02-
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
version: '0.0'
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.0.
|
56
|
+
version: 0.0.7
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
version: '0.0'
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.0.
|
66
|
+
version: 0.0.7
|
67
67
|
description: Use controller's classes with instance methods as routing actions, mounting
|
68
68
|
its in application class.
|
69
69
|
email:
|