rackr 0.0.67 → 0.0.68

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rackr/action.rb +22 -2
  3. data/lib/rackr.rb +2 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2c53919b2365343fd55636d5d3a29b41e93975a60ef3d2af74416e12808f27a
4
- data.tar.gz: 32f5c5da65e14bf318c07427fd5bb0f9c978c04d75e94877ddab0793da4a8005
3
+ metadata.gz: f73af417da9875005db2b3ee4f61d9c8a646721d97791b1737ec5e3868145cee
4
+ data.tar.gz: 984c3a38fa157758f04414c4d963ee901771c535e5dd1e3047a403c649c13a3a
5
5
  SHA512:
6
- metadata.gz: 8e0decd638c32afe394950c7b45bf44539704b136bde9d9e9dfc2a698e37c427317e16fb310bb6515d0f4a339fd224228d9d5ee424ddbaca7f191ec8f40f4b27
7
- data.tar.gz: 04117f475a16165a813cac337f72880e6d461ffe41e3ce085ab06690fbc4b21a85f1f22d343fa4a4b070f4a7d9898f26eec29d231df7c8b9469b4d2d60f34848
6
+ metadata.gz: 1f5c8dfaa7a2329474ac15f27a8ba4330f2b53df85b0ddf141e053dfa0b5efb14c6af7bee05c3f8fc70fae968563c33a2b08a7f693db4a3e7e769e9b51a17561
7
+ data.tar.gz: 2455b933241dcbae25f6c4ad60ffbd3aab03a1121d16a57b681318461a5e08e9b3c70d54102a2a1869b7f20d041d9383c4f73e1988d7e4137afde586d7cf328d
data/lib/rackr/action.rb CHANGED
@@ -169,7 +169,17 @@ class Rackr
169
169
  routes.send(method)&.dig(name)
170
170
  end
171
171
 
172
- def render(**opts)
172
+ def render(content = nil, **opts)
173
+ if content
174
+ return RENDER[:html].call(
175
+ content.to_s,
176
+ opts[:status],
177
+ opts[:headers] || {},
178
+ opts[:charset] || 'utf-8',
179
+ content_security_policy
180
+ )
181
+ end
182
+
173
183
  type = opts.keys.first
174
184
  content = opts[type]
175
185
 
@@ -206,7 +216,17 @@ class Rackr
206
216
  )
207
217
  end
208
218
 
209
- def build_response(**opts)
219
+ def build_response(content = nil, **opts)
220
+ if content
221
+ return BUILD_RESPONSE[:html].call(
222
+ content.to_s,
223
+ opts[:status] || 200,
224
+ opts[:headers] || {},
225
+ opts[:charset] || 'utf-8',
226
+ content_security_policy
227
+ )
228
+ end
229
+
210
230
  type = opts.keys.first
211
231
  content = opts[type]
212
232
 
data/lib/rackr.rb CHANGED
@@ -7,6 +7,8 @@ require_relative 'rackr/router'
7
7
 
8
8
  # Rackr is a simple router for Rack.
9
9
  class Rackr
10
+ VERSION = '0.0.68'
11
+
10
12
  class NotFound < StandardError; end
11
13
 
12
14
  # Dump is a special error that is used to dump the content of a request.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.67
4
+ version: 0.0.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique F. Teixeira
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-01-05 00:00:00.000000000 Z
10
+ date: 2026-01-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: erubi