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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b8383cdd86873f1c48723c2c1bb2ea364118441
4
- data.tar.gz: f6b4af700c45d5bd103e545f395f83b1afd6f4be
3
+ metadata.gz: 7e934a6b8356c082c5adbf9010ebcf19c5cfdc01
4
+ data.tar.gz: 16ead4865ce5d9265aaf7fc7d38de401b034b816
5
5
  SHA512:
6
- metadata.gz: e25c7c816f722c92d7f4962469d8f02fcf10001d0a6a3e2cc3b2e304b5ea8c3269e195b5949e63b2bb458d1c0f334624d078822f4f7d764a5a8596d6d055a329
7
- data.tar.gz: a7cdaa073a030b8f9dd748d6233c0ca6fd2156827a3c34583db2f78df342d8f94f244c4026a555da707133cce51ccbab995d2a6ed4d926f9886ce823422a4385
6
+ metadata.gz: ef6fe5a9eb6e074ad671ee088b18966bdf894002bcb6afe00f814d21772f77477bc04cdff2611d84cc94ac22acfddb168c4bc294d07912a5d675de552df5d9b5
7
+ data.tar.gz: c26c8020c593d48f8bf185833abc0602951c67ee1a0fcbe4ae874fa80d6af874fede4fd29a6ff37f2d94a2e6bb616d92caa3f4b4d7f29d1a3e8c09e6383df782
@@ -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
@@ -82,7 +82,7 @@ module Flame
82
82
  response[Rack::CONTENT_TYPE] = Rack::Mime.mime_type(ext)
83
83
  end
84
84
 
85
- ## Get path for controller and action.
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
- fail Errors::RouteNotFoundError.new(ctrl, action) unless route
95
+ raise Errors::RouteNotFoundError.new(ctrl, action) unless route
96
96
  path = route.assign_arguments(args)
97
97
  path.empty? ? '/' : path
98
98
  end
@@ -102,7 +102,7 @@ module Flame
102
102
  param = args[path_part[1..-1].to_sym]
103
103
  ## Required argument is nil
104
104
  error = Errors::ArgumentNotAssignedError.new(path, path_part)
105
- fail error if param.nil?
105
+ raise error if param.nil?
106
106
  ## All is ok
107
107
  param
108
108
  end
@@ -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
- fail Errors::RouterError::ExtraPathArgumentsError.new(
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
- fail Errors::RouterError::ExtraActionArgumentsError.new(
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
- fail Errors::RouterError::ExtraRoutesActionsError.new(
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
- fail Errors::RouterError::ExtraControllerActionsError.new(
91
+ raise Errors::RouterError::ExtraControllerActionsError.new(
92
92
  @ctrl, extra_ctrl_actions
93
93
  )
94
94
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Flame
4
- VERSION = '4.3.3'.freeze
4
+ VERSION = '4.3.4'.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.3.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-23 00:00:00.000000000 Z
11
+ date: 2016-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack