shale-builder 0.9.1 → 0.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a856175f03b1a09320b45d95ce15389523ef1dcc144cd43465ef158ede3d58a5
4
- data.tar.gz: 8e04cd5334e75d2b01010ec5074b160beb6397f23fb2e17a30fb4bd67b45c57b
3
+ metadata.gz: 4a329a5a450fc1482e62dbd231927e1880d388ececc2985e91d21077ad885e00
4
+ data.tar.gz: 418dee2e1d27d2b8d75d80bed7fad2d0681264031005c9f4b68a545cc109c656
5
5
  SHA512:
6
- metadata.gz: 4398f91a2061891d5d4c113fe4bfa23d3cf71e2d37bcc860554390dc6fb05c370c11060fefb3b3f3c54d3d48bddab0664fcc023c2e1cc9c739a8ab5153ac5ea7
7
- data.tar.gz: e29af058ad0a347ad4afa01332a5aaa6e78af78fa21ea60ef4cbb01184fdc18d061df5327dd21b479977e28a2745e35f451f934f5798ff58e51292e258708bac
6
+ metadata.gz: aff2e48163db0b228653fc6ad0b55f5aa2b7a3ef183a04a8a041a7b79e59de060b52d7c7a937b1ab4a735ae35b079fbae915346ba77fa48607cdc0129b212e97
7
+ data.tar.gz: 193524cd944305a5f562c44974980d8e3b244c04aa30910930d63010343109a9c59f8bfe2476d7e8c1b154d0d3349e8f41ea4af5443b3ef16bab31eb1077759c
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.2] - 2026-04-24
9
+
10
+ [Diff](https://github.com/Verseth/ruby-shale-builder/compare/v0.8.5...v0.9.2)
11
+
12
+ ### Changes
13
+ - Change `memoize:` kwarg into `memo_#{attr_name}`
14
+
8
15
  ## [0.9.0] - 2026-04-24
9
16
 
10
17
  [Diff](https://github.com/Verseth/ruby-shale-builder/compare/v0.8.5...v0.9.0)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shale-builder (0.9.1)
4
+ shale-builder (0.9.2)
5
5
  booleans (>= 0.1)
6
6
  shale (< 2.0)
7
7
  sorbet-runtime (> 0.5)
data/README.md CHANGED
@@ -169,7 +169,7 @@ transaction.amount.currency #=> nil
169
169
 
170
170
  You can change the behaviour of builder methods
171
171
  so that they preserve existing objects when called a second time.
172
- You do that by using the `memoize: true` keyword argument.
172
+ You do that by prepending the method name with `memo_`.
173
173
 
174
174
  ```rb
175
175
  transaction = Transaction.build do |t|
@@ -177,7 +177,7 @@ transaction = Transaction.build do |t|
177
177
  a.value = 2.3
178
178
  a.currency = 'PLN'
179
179
  end
180
- t.amount(memoize: true) do |a|
180
+ t.memo_amount do |a|
181
181
  a.value = 10
182
182
  end
183
183
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Shale
4
4
  module Builder
5
- VERSION = '0.9.1'
5
+ VERSION = '0.9.2'
6
6
  end
7
7
  end
@@ -116,7 +116,6 @@ module Tapioca
116
116
  # simple getter
117
117
  sigs << mod.create_sig(
118
118
  parameters: {
119
- memoize: 'FalseClass',
120
119
  block: 'NilClass',
121
120
  },
122
121
  return_type: getter_without_block_type,
@@ -124,7 +123,6 @@ module Tapioca
124
123
  # getter with block
125
124
  sigs << mod.create_sig(
126
125
  parameters: {
127
- memoize: 'T::Boolean',
128
126
  block: "T.proc.params(arg0: #{type}).void"
129
127
  },
130
128
  return_type: type.to_s
@@ -134,24 +132,54 @@ module Tapioca
134
132
  sigs: sigs,
135
133
  comments: comments,
136
134
  parameters: [
137
- RBI::KwOptParam.new('memoize', 'false'),
135
+ RBI::BlockParam.new('block'),
136
+ ],
137
+ )
138
+
139
+ mod.create_method_with_sigs(
140
+ "memo_#{method_name}",
141
+ sigs: [
142
+ mod.create_sig(
143
+ parameters: {
144
+ block: "T.proc.params(arg0: #{type}).void"
145
+ },
146
+ return_type: type.to_s
147
+ )
148
+ ],
149
+ comments: [
150
+ RBI::Comment.new("Version of `#{method_name}` that memoizes the previous object if it was already present.\n"),
151
+ *comments,
152
+ ],
153
+ parameters: [
138
154
  RBI::BlockParam.new('block'),
139
155
  ],
140
156
  )
141
157
  else
142
158
  # for tapioca >= 0.16.0
143
159
  mod.create_method(method_name, comments: comments) do |method|
144
- method.add_kw_opt_param('memoize', 'false')
145
160
  method.add_block_param('block')
146
161
 
147
162
  method.add_sig do |sig|
148
- sig.add_param('memoize', 'FalseClass')
149
163
  sig.add_param('block', 'NilClass')
150
164
  sig.return_type = getter_without_block_type
151
165
  end
152
166
 
153
167
  method.add_sig do |sig|
154
- sig.add_param('memoize', 'T::Boolean')
168
+ sig.add_param('block', "T.proc.params(arg0: #{type}).void")
169
+ sig.return_type = type.to_s
170
+ end
171
+ end
172
+
173
+ mod.create_method(
174
+ "memo_#{method_name}",
175
+ comments: [
176
+ RBI::Comment.new("Version of `#{method_name}` that memoizes the previous object if it was already present.\n"),
177
+ *comments,
178
+ ],
179
+ ) do |method|
180
+ method.add_block_param('block')
181
+
182
+ method.add_sig do |sig|
155
183
  sig.add_param('block', "T.proc.params(arg0: #{type}).void")
156
184
  sig.return_type = type.to_s
157
185
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shale-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Drewniak