flame 4.0.5 → 4.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5878fea74c5c10e10b235d28652f1443563d174f
4
- data.tar.gz: ea1edb1402a414b601952ef852c2aa00d043f41b
3
+ metadata.gz: 7e3eff2ff95d66cad8d31d30b8938ee7f7936726
4
+ data.tar.gz: c8b3793fab9614b8c710f71e01f22f2c25dde926
5
5
  SHA512:
6
- metadata.gz: 7e448213ec77f57a6014c315f4dd3cbc5a6477ac8c805820da9bba4c4c13a78bc72a9bdc0c55c3f24fdd2fb06b2aacbfa2891b7bd0dd95412522d62b9e48c401
7
- data.tar.gz: a23c186cb889b2473d339e02232e6d52b1d2a30480222e726acd0facd0590d703fb2363667642758cc702d530c4dfe08d3448648e868f3b7c675b23bcb8b215e
6
+ metadata.gz: 98e65d7b60f888c271b83e987b4cbf5c56a800f0fcf30678d29f1df5546d835194728656c9bcf0808ded1e278e897a116f90ead91899f05cde915cb1d053cff8
7
+ data.tar.gz: 5d7e63b49ad424fa33d3319daaa585e038a0942cc633489a3d139f0557b59d035f1f4787b4459375713a42f2ac2e8791de020d4f05c3ff2165de4c7484c25bb6
@@ -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
- route[:controller].new(self).execute(route[:action])
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[:controller].new(self).execute(:not_found)
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
@@ -41,7 +41,7 @@ module Flame
41
41
  end
42
42
  end
43
43
 
44
- using GorillaPatch::StringExt
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.name.underscore.split('/').map do |part|
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('/')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Flame
4
- VERSION = '4.0.5'.freeze
4
+ VERSION = '4.0.6'.freeze
5
5
  end
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.5
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-03 00:00:00.000000000 Z
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.6
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.6
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: