Skip to content

Commit

Permalink
Fix logic bug in html
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Apr 6, 2024
1 parent e82e7b7 commit 32abf19
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
streamlined (0.5.0)
streamlined (0.5.1)
serbea (>= 2.1)
zeitwerk (~> 2.5)

Expand Down
6 changes: 5 additions & 1 deletion lib/streamlined/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlined/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Streamlined
VERSION = "0.5.0"
VERSION = "0.5.1"
end
2 changes: 1 addition & 1 deletion test/test_streamlined.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def template(&block)
<section>
<h1 #{html_attributes(false_value:, nil_value:, other_value:)}>#{text -> { heading }}</h1>
<h2 class="#{text -> { tags_in_attribute }}">#{text -> { @name }}</h2>
#{html self, -> { capture -> { block } }}
#{html self, -> { capture(block) }}
<footer>#{text @number, -> { multiplied_by(10) }}</footer>
</section>
HTML
Expand Down

0 comments on commit 32abf19

Please sign in to comment.