scorched 1.1.0 → 1.1.1

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
  SHA256:
3
- metadata.gz: 7a838c96acf81063ddc76cc2a26fe3497b7fd83de1b095ba4d9cef042835b9ed
4
- data.tar.gz: 0de14593266fcf5df232a6f56cc89ca4de8d9b7de9d8a4df2fbc173974d55aca
3
+ metadata.gz: 9e9063c14895226f457fcb9255e206f5915a8aaefde84be0114dabbf4723a677
4
+ data.tar.gz: e773ac700d17abe3b3ce00f94be2665e4753bacffee9ce07fc4e86a00f35afec
5
5
  SHA512:
6
- metadata.gz: a76db1e57fc1a1a62428e3e3e728ecc4eeee9d504579e5a7894c4e07ed0d819306f0ea2b73725e605e129ee188d864e1cbaf145c2e7eda6e1aea39e4f51ef930
7
- data.tar.gz: 7b7185d2a622ac50111c0e3fbd5104e962ae2afc26c9058d07493b1a3666111bbf2b274c8afef1967697f319a268f1ff97d94511914509de4ed1bd4fd008b872
6
+ metadata.gz: 2444d1752e6296881377c74c21a6219b19b9ef415165e89382d4b9f3d80b8e7030c5997cf8fcffeb6377c5f58cd96431019f170ee75577210564798b61514764
7
+ data.tar.gz: 61dae3a5d9f0d4d35d53be9db55c157d0e0cbdeee1bcf504a0d9069fa674ad993e95c865ddcf8165d78ed5c2dd1f567184baecc1be90f69017d329f79642e75c
data/CHANGES.md CHANGED
@@ -1,6 +1,8 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ### v1.1.1
5
+ * Fixed frozen string mutation in `absolute` method.
4
6
  ### v1.1.0
5
7
  * Added `around` filters to allow wrapping application logic around a request. `around` filters wrap around `before/after` filters. Ideal for `begin...ensure...end` where you need to ensure something happens before the request processing ends. For example:
6
8
  ```
@@ -117,7 +117,7 @@ Conditions are essentially just pre-requisites that must be met before a mapping
117
117
  * `:host` - The host name (i.e. domain name) used in the request.
118
118
  * `:language` - Languages accepted by the client.
119
119
  * `:media_type` - Media types (i.e. content types) accepted by the client.
120
- * `:handled` - Whether a mapping in the controller instance was invoked as the target for the request. A mapping that _passes_ a request is not considered a match.
120
+ * `:dispatched` - Whether a mapping in the controller instance was invoked as the target for the request. A mapping that _passes_ a request is not considered dispatched.
121
121
  * `:method` - The request method used, e.g. GET, POST, PUT, ... .
122
122
  * `:proc` - An on-the-fly condition to be evaluated in the context of the controller instance. Should return true if the condition was satisfied, or false otherwise.
123
123
  * `:user_agent` - The user agent string provided with the request. Takes a Regexp or String.
@@ -42,6 +42,25 @@ end
42
42
  How you use filters is up to your own imagination and creative problem solving.
43
43
 
44
44
 
45
+ Around Filters
46
+ --------------
47
+ Around filters wrap the entire before/dispatch/after cycle. The block is passed a single argument - a proc representing the rest of the filter chain - which it must call (e.g. `cont.call`) for request handling to proceed. If the block doesn't call it, the wrapped request chain never runs.
48
+
49
+ Around filters defined earlier (including those defined in superclasses) wrap those defined later. Around filters are ideal for `begin...ensure...end`-style wrapping, where you need to guarantee something happens once the request has finished processing.
50
+
51
+ ```ruby
52
+ around do |cont|
53
+ begin
54
+ cont.call
55
+ ensure
56
+ # Ensure something important happens here
57
+ end
58
+ end
59
+ ```
60
+
61
+ Like before and after filters, around filters can have conditions defined on them.
62
+
63
+
45
64
  Error Filters
46
65
  -------------
47
66
  Error filters are processed like regular filters, except they're called whenever an exception occurs. If an error filter returns false, it's assumed to be unhandled, and the next error filter is called. This continues until one of the following is true, 1) an error filter returns true, in which case the exception is assumed to be handled, 2) an error filter raises an exception itself, or 3) there are no more error handlers defined on the current controller, in which case the exception is re-raised.
@@ -573,9 +573,10 @@ module Scorched
573
573
  else
574
574
  env['scorched.root_path']
575
575
  end
576
- abs.insert(0, '/') unless abs[0] == '/'
576
+ abs = "/#{abs}" unless abs[0] == '/'
577
577
  abs
578
578
  end
579
+
579
580
 
580
581
  # We always want this filter to run at the end-point controller, hence we include the conditions within the body of
581
582
  # the filter.
@@ -1,3 +1,3 @@
1
1
  module Scorched
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorched
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Wardrop