streamlined 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05f5b1f3f4076db6a1199096cd1da0c78594161b4fadb12bbd5e8777a7d5993f
4
- data.tar.gz: 1db72d9247ae8d7d5f1b2c49de47c30c8b7341cc50bac7f434386d9ac8eb5555
3
+ metadata.gz: 2f6d5e0e63a6f2acc9944f0b703943dc3481e6430cfd19c89df6bd3b68e84a2b
4
+ data.tar.gz: 1b9c27c5af0cd0cf0dde74aaae73c6cb1add9ebd32a510ca3b2b119749b84994
5
5
  SHA512:
6
- metadata.gz: 6539b91a92c00001129658a57d139f19672ea07be9ea54a38d1fa04dc2579e7d98d40d439d49a9d24d9a9207228733f03fb8756651fcfefa0e34acc2054d5e42
7
- data.tar.gz: 045c5edea6a3f743461ae9fa0a5918867daeb8b59e7ac643576bb3c624a16ed3a1d5e360e1280c8514514c66eff91e01664757b464298912ba7abbf465a43322
6
+ metadata.gz: 662a0b51ff471acb258b6529c6a9a9b64d1de6062d082301e030f03e4821b82537b050ccdf2ba690426c5441e717f7ba70f6e41e42fa0a28fefd090d4f00b9f6
7
+ data.tar.gz: 13978e66cd60115cacfeed50d7397c016a04343bad73c862eb6fbd6bd9c21bdd90e1eb3cb292b2b73c73b68822cf90a4f818957e0b33c6cfdf7f855f11912360
data/.rubocop.yml CHANGED
@@ -48,6 +48,9 @@ Metrics/MethodLength:
48
48
  Naming/BlockForwarding:
49
49
  Enabled: false
50
50
 
51
+ Style/ArgumentsForwarding:
52
+ Enabled: false
53
+
51
54
  # Disabled to aid in template readability
52
55
  Style/NestedParenthesizedCalls:
53
56
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.5.0 - 2024-04-06
6
+
7
+ - Simplify syntax of pipe procs for text & html
8
+
5
9
  ## [0.4.0] — 2024-04-04
6
10
 
7
11
  - Provide Roda plugin to mix in Streamlined helpers.
data/Gemfile CHANGED
@@ -13,7 +13,7 @@ gem "minitest-reporters", "~> 1.5"
13
13
  gem "rubocop", "~> 1.21"
14
14
  gem "rubocop-bridgetown", "~> 0.4"
15
15
 
16
- gem "solargraph", "~> 0.49.0"
16
+ gem "solargraph", "~> 0.50"
17
17
 
18
18
  gem "rails-dom-testing", "~> 2.0"
19
19
 
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- streamlined (0.4.0)
4
+ streamlined (0.5.0)
5
5
  serbea (>= 2.1)
6
6
  zeitwerk (~> 2.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.1.1)
11
+ activesupport (7.1.3.2)
12
12
  base64
13
13
  bigdecimal
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -21,39 +21,38 @@ GEM
21
21
  ansi (1.5.0)
22
22
  ast (2.4.2)
23
23
  backport (1.2.0)
24
- base64 (0.1.1)
25
- benchmark (0.2.1)
26
- bigdecimal (3.1.4)
24
+ base64 (0.2.0)
25
+ benchmark (0.3.0)
26
+ bigdecimal (3.1.7)
27
27
  builder (3.2.4)
28
- concurrent-ruby (1.2.2)
28
+ concurrent-ruby (1.2.3)
29
29
  connection_pool (2.4.1)
30
- diff-lcs (1.5.0)
31
- drb (2.1.1)
32
- ruby2_keywords
30
+ diff-lcs (1.5.1)
31
+ drb (2.2.1)
33
32
  e2mmap (0.1.0)
34
33
  erubi (1.12.0)
35
- i18n (1.14.1)
34
+ i18n (1.14.4)
36
35
  concurrent-ruby (~> 1.0)
37
36
  jaro_winkler (1.5.6)
38
- json (2.6.3)
37
+ json (2.7.2)
39
38
  kramdown (2.4.0)
40
39
  rexml
41
40
  kramdown-parser-gfm (1.1.0)
42
41
  kramdown (~> 2.0)
43
42
  language_server-protocol (3.17.0.3)
44
- minitest (5.20.0)
43
+ minitest (5.22.3)
45
44
  minitest-reporters (1.6.1)
46
45
  ansi
47
46
  builder
48
47
  minitest (>= 5.0)
49
48
  ruby-progressbar
50
- mutex_m (0.1.2)
51
- nokogiri (1.15.4-arm64-darwin)
49
+ mutex_m (0.2.0)
50
+ nokogiri (1.16.3-arm64-darwin)
52
51
  racc (~> 1.4)
53
- nokogiri (1.15.4-x86_64-linux)
52
+ nokogiri (1.16.3-x86_64-linux)
54
53
  racc (~> 1.4)
55
- parallel (1.23.0)
56
- parser (3.2.2.4)
54
+ parallel (1.24.0)
55
+ parser (3.3.0.5)
57
56
  ast (~> 2.4.1)
58
57
  racc
59
58
  racc (1.7.3)
@@ -62,41 +61,40 @@ GEM
62
61
  minitest
63
62
  nokogiri (>= 1.6)
64
63
  rainbow (3.1.1)
65
- rake (13.1.0)
64
+ rake (13.2.0)
66
65
  rbs (2.8.4)
67
- regexp_parser (2.8.2)
66
+ regexp_parser (2.9.0)
68
67
  reverse_markdown (2.1.1)
69
68
  nokogiri
70
69
  rexml (3.2.6)
71
- rubocop (1.57.2)
70
+ rubocop (1.62.1)
72
71
  json (~> 2.3)
73
72
  language_server-protocol (>= 3.17.0)
74
73
  parallel (~> 1.10)
75
- parser (>= 3.2.2.4)
74
+ parser (>= 3.3.0.2)
76
75
  rainbow (>= 2.2.2, < 4.0)
77
76
  regexp_parser (>= 1.8, < 3.0)
78
77
  rexml (>= 3.2.5, < 4.0)
79
- rubocop-ast (>= 1.28.1, < 2.0)
78
+ rubocop-ast (>= 1.31.1, < 2.0)
80
79
  ruby-progressbar (~> 1.7)
81
80
  unicode-display_width (>= 2.4.0, < 3.0)
82
- rubocop-ast (1.30.0)
83
- parser (>= 3.2.1.0)
81
+ rubocop-ast (1.31.2)
82
+ parser (>= 3.3.0.4)
84
83
  rubocop-bridgetown (0.4.1)
85
84
  rubocop (~> 1.23)
86
85
  rubocop-performance (~> 1.12)
87
86
  rubocop-minitest (0.20.1)
88
87
  rubocop (>= 0.90, < 2.0)
89
- rubocop-performance (1.19.1)
90
- rubocop (>= 1.7.0, < 2.0)
91
- rubocop-ast (>= 0.4.0)
88
+ rubocop-performance (1.21.0)
89
+ rubocop (>= 1.48.1, < 2.0)
90
+ rubocop-ast (>= 1.31.1, < 2.0)
92
91
  rubocop-rake (0.6.0)
93
92
  rubocop (~> 1.0)
94
93
  ruby-progressbar (1.13.0)
95
- ruby2_keywords (0.0.5)
96
94
  serbea (2.1.0)
97
95
  erubi (>= 1.10)
98
96
  tilt (~> 2.0)
99
- solargraph (0.49.0)
97
+ solargraph (0.50.0)
100
98
  backport (~> 1.2)
101
99
  benchmark
102
100
  bundler (~> 2.0)
@@ -112,13 +110,13 @@ GEM
112
110
  thor (~> 1.0)
113
111
  tilt (~> 2.0)
114
112
  yard (~> 0.9, >= 0.9.24)
115
- thor (1.3.0)
113
+ thor (1.3.1)
116
114
  tilt (2.3.0)
117
115
  tzinfo (2.0.6)
118
116
  concurrent-ruby (~> 1.0)
119
117
  unicode-display_width (2.5.0)
120
- yard (0.9.34)
121
- zeitwerk (2.6.12)
118
+ yard (0.9.36)
119
+ zeitwerk (2.6.13)
122
120
 
123
121
  PLATFORMS
124
122
  arm64-darwin-21
@@ -133,7 +131,7 @@ DEPENDENCIES
133
131
  rubocop-bridgetown (~> 0.4)
134
132
  rubocop-minitest (~> 0.20.0)
135
133
  rubocop-rake (~> 0.6.0)
136
- solargraph (~> 0.49.0)
134
+ solargraph (~> 0.50)
137
135
  streamlined!
138
136
 
139
137
  BUNDLED WITH
@@ -1,19 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "tilt/erubi"
4
+
3
5
  module Streamlined
4
6
  module Helpers
5
- module PipeableProc
6
- include Serbea::Pipeline::Helper
7
-
8
- attr_accessor :pipe_block, :touched
9
-
10
- def pipe(&block)
11
- return super(self.(), &pipe_block) if pipe_block && !block
7
+ module TouchableProc
8
+ attr_accessor :touched
12
9
 
10
+ def touch
13
11
  self.touched = true
14
- return self unless block
15
-
16
- tap { _1.pipe_block = block }
12
+ self
17
13
  end
18
14
 
19
15
  def html_safe
@@ -36,7 +32,7 @@ module Streamlined
36
32
  end
37
33
  end
38
34
 
39
- ::Proc.prepend(PipeableProc)
35
+ ::Proc.prepend(TouchableProc)
40
36
 
41
37
  # Create a set of attributes from a hash.
42
38
  #
@@ -82,16 +78,20 @@ module Streamlined
82
78
  "#{attr}=#{value.to_s.encode(xml: :attr)}"
83
79
  end
84
80
 
85
- def text(callback)
86
- (callback.is_a?(Proc) ? callback.pipe : callback).to_s.then do |str|
81
+ def text(callback, piping = nil)
82
+ callback = Serbea::Pipeline.new(binding, callback).tap { _1.instance_exec(&piping) } if piping
83
+
84
+ (callback.is_a?(Proc) ? callback.touch : callback).to_s.then do |str|
87
85
  next str if str.html_safe?
88
86
 
89
87
  str.encode(xml: :attr).gsub(%r{\A"|"\Z}, "")
90
88
  end
91
89
  end
92
90
 
93
- def html(callback)
94
- callback.html_safe.pipe
91
+ def html(callback, piping = nil)
92
+ callback = Serbea::Pipeline.new(binding, callback).tap { _1.instance_exec(&piping) } if piping
93
+
94
+ callback.html_safe.touch
95
95
  end
96
96
 
97
97
  def html_map(input, &callback)
@@ -45,10 +45,8 @@ module Streamlined
45
45
  @_view_context
46
46
  end
47
47
 
48
- # rubocop:disable Style/ArgumentsForwarding
49
48
  def capture(*args, &block)
50
49
  helpers ? helpers.capture(*args, &block) : yield(*args)
51
50
  end
52
- # rubocop:enable Style/ArgumentsForwarding
53
51
  end
54
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Streamlined
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: streamlined
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2024-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serbea