orb_template 0.2.3 → 0.2.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/orb/rails_template.rb +20 -9
- data/lib/orb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd68f471e3fbd9acaad2e9c35de29d1b7007c012095b477bdedc0ee2e5c97f8e
|
|
4
|
+
data.tar.gz: fc4531a398382faea20b133b34b57b821826bd98390bcf30d1017016b3538114
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7643721a1c16badd894605c1e99832ed2ea782ff2f67b5169b0ef26ee6b97b36ecd7f201adfb61976a93cdcbc8925a2dbcc7a7aa0240a660f6521c268b4abc7c
|
|
7
|
+
data.tar.gz: d33b3d3c66f7915d3e03057050e97fad95d2de709e34edd2f12b6522d49dcb1f961d798527490f84d9001218718af48469f523e927be8da52c0bcff09108650b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.2.4] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed `ORB::Temple::Engine: Option :capture_generator is invalid` — replaced separate `CaptureBuffer` class with `ORB::OutputBuffer` that uses `define_options` to register `capture_generator` as a valid option and conditionally returns `nil` from `return_buffer` when acting as a capture generator
|
|
8
|
+
|
|
3
9
|
## [0.2.3] - 2026-03-22
|
|
4
10
|
|
|
5
11
|
### Fixed
|
data/lib/orb/rails_template.rb
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module ORB
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
# Generator that fixes void-context warnings from Temple's AttributeRemover.
|
|
5
|
+
#
|
|
6
|
+
# AttributeRemover wraps dynamic attributes (e.g. class={expr}) in a
|
|
7
|
+
# [:capture, tmp, ...] + [:if, "!tmp.empty?", ...] pair. The default
|
|
8
|
+
# RailsOutputBuffer uses itself as the capture generator, and its
|
|
9
|
+
# return_buffer (inherited from StringBuffer) emits the bare variable
|
|
10
|
+
# name as the last expression. Inside the surrounding :multi this
|
|
11
|
+
# becomes a statement in void context since Ruby -w warns about it.
|
|
12
|
+
#
|
|
13
|
+
# This subclass returns nil from return_buffer when acting as a capture
|
|
14
|
+
# generator (buffer != @output_buffer), suppressing the bare variable.
|
|
15
|
+
class OutputBuffer < ::Temple::Generators::RailsOutputBuffer
|
|
16
|
+
define_options capture_generator: ORB::OutputBuffer
|
|
17
|
+
|
|
18
|
+
def return_buffer
|
|
19
|
+
buffer == '@output_buffer' ? super : nil
|
|
11
20
|
end
|
|
21
|
+
end
|
|
12
22
|
|
|
23
|
+
class RailsTemplate
|
|
24
|
+
require 'orb/utils/orb'
|
|
13
25
|
# Compatible with: https://github.com/judofyr/temple/blob/v0.7.7/lib/temple/mixins/options.rb#L15-L24
|
|
14
26
|
class << self
|
|
15
27
|
def options
|
|
16
28
|
@options ||= {
|
|
17
|
-
generator: ::
|
|
18
|
-
capture_generator: CaptureBuffer,
|
|
29
|
+
generator: ORB::OutputBuffer,
|
|
19
30
|
use_html_safe: true,
|
|
20
31
|
streaming: true,
|
|
21
32
|
buffer_class: 'ActionView::OutputBuffer',
|
data/lib/orb/version.rb
CHANGED