shale-builder 0.9.0 → 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 +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/shale/builder/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/shale.rb +34 -6
- 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: 4a329a5a450fc1482e62dbd231927e1880d388ececc2985e91d21077ad885e00
|
|
4
|
+
data.tar.gz: 418dee2e1d27d2b8d75d80bed7fad2d0681264031005c9f4b68a545cc109c656
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
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
|
|
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.
|
|
180
|
+
t.memo_amount do |a|
|
|
181
181
|
a.value = 10
|
|
182
182
|
end
|
|
183
183
|
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,7 +132,25 @@ module Tapioca
|
|
|
134
132
|
sigs: sigs,
|
|
135
133
|
comments: comments,
|
|
136
134
|
parameters: [
|
|
137
|
-
RBI::
|
|
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
|
)
|
|
@@ -142,16 +158,28 @@ module Tapioca
|
|
|
142
158
|
# for tapioca >= 0.16.0
|
|
143
159
|
mod.create_method(method_name, comments: comments) do |method|
|
|
144
160
|
method.add_block_param('block')
|
|
145
|
-
method.add_kw_opt_param('memoize', 'false')
|
|
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('
|
|
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
|