From 32abf195a64cac17ad3374d2099b6d58ca568f9a Mon Sep 17 00:00:00 2001 From: Jared White Date: Sat, 6 Apr 2024 08:29:11 -0700 Subject: [PATCH] Fix logic bug in `html` --- CHANGELOG.md | 8 ++++++-- Gemfile.lock | 2 +- lib/streamlined/helpers.rb | 6 +++++- lib/streamlined/version.rb | 2 +- test/test_streamlined.rb | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed1f68f..ee9f301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,13 @@ ## [Unreleased] -## [0.5.0 - 2024-04-06 +## [0.5.1] - 2024-04-06 -- Simplify syntax of pipe procs for text & html +- Fix logic bug in `html` + +## [0.5.0] - 2024-04-06 + +- Simplify syntax of pipe procs for `text` & `html` ## [0.4.0] — 2024-04-04 diff --git a/Gemfile.lock b/Gemfile.lock index bde055b..58b662f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - streamlined (0.5.0) + streamlined (0.5.1) serbea (>= 2.1) zeitwerk (~> 2.5) diff --git a/lib/streamlined/helpers.rb b/lib/streamlined/helpers.rb index 6b2c402..9d9a0a1 100644 --- a/lib/streamlined/helpers.rb +++ b/lib/streamlined/helpers.rb @@ -89,7 +89,11 @@ def text(callback, piping = nil) end def html(callback, piping = nil) - callback = Serbea::Pipeline.new(binding, callback).tap { _1.instance_exec(&piping) } if piping + if piping + callback = Serbea::Pipeline.new(binding, callback).tap { _1.instance_exec(&piping) }.then do |pipeline| + -> { pipeline.value } + end + end callback.html_safe.touch end diff --git a/lib/streamlined/version.rb b/lib/streamlined/version.rb index 768e53d..474db90 100644 --- a/lib/streamlined/version.rb +++ b/lib/streamlined/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Streamlined - VERSION = "0.5.0" + VERSION = "0.5.1" end diff --git a/test/test_streamlined.rb b/test/test_streamlined.rb index 9b396a6..1fed5b5 100644 --- a/test/test_streamlined.rb +++ b/test/test_streamlined.rb @@ -54,7 +54,7 @@ def template(&block)

#{text -> { heading }}

#{text -> { @name }}

- #{html self, -> { capture -> { block } }} + #{html self, -> { capture(block) }}
HTML