artisanal-model 0.2.0 → 0.2.1
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 +14 -0
- data/README.md +11 -8
- data/artisanal-model.gemspec +5 -5
- data/lib/artisanal/model/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e7d75444f838582f497d9f9791d95c48a996961086228382014aa4e528e721
|
4
|
+
data.tar.gz: 7462863d53007667134440a19ddb604ba302d5cb1a91d529247f51d294ef2027
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c966b5f4f879f8b63ce9dac63dba60cfa277905f56de0b71e1a3ed934f8e01671345778ec229523b74d8af3f9437096b659934c305ceafb473c6fdd499484795
|
7
|
+
data.tar.gz: 6bcb53d248f119b1a78925c241870088750b8aa29a7f3a80b214496dff4788693afbcdb3e6f2b9720db9306a02b37984962059d835de98d70a7b5f430143aaf0
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.2.1] - 2024-04-09
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
- Corrected .gemspec with links to the forked Github repository
|
7
|
+
- Added some description to README.md regarding the fork
|
8
|
+
- Added CHANGELOG.md
|
9
|
+
|
10
|
+
## [0.2.0] - 2024-04-09
|
11
|
+
|
12
|
+
### Enhancements
|
13
|
+
- Forked from [goldstar/artisanal-model](https://github.com/goldstar/artisanal-model)
|
14
|
+
- Support Ruby 3 ([#1](https://github.com/stellarlive/artisanal-model/pull/1))
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# artisanal-model
|
2
|
+
This has been forked from [goldstar/artisanal-model](https://github.com/goldstar/artisanal-model).
|
2
3
|
|
3
4
|
Artisanal::Model is a light-weight attribute modeling DSL that wraps [dry-initializer](https://dry-rb.org/gems/dry-initializer/), providing extra configuration and a slightly cleaner DSL.
|
4
5
|
|
6
|
+
The fork intends to patch some keyword argument caveats that were necessary for Stellar to upgrade to Ruby 3.0.6. The original functionality is meant to be kept intact.
|
7
|
+
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
@@ -17,7 +20,7 @@ And then execute:
|
|
17
20
|
Or install it yourself as:
|
18
21
|
|
19
22
|
$ gem install artisanal-model
|
20
|
-
|
23
|
+
|
21
24
|
## Configuration
|
22
25
|
|
23
26
|
Artisanal::Model configuration is done on a per-model basis. There is no global configuration (at this time):
|
@@ -168,7 +171,7 @@ class Tag < Model
|
|
168
171
|
attribute :name
|
169
172
|
end
|
170
173
|
|
171
|
-
class Person < Model
|
174
|
+
class Person < Model
|
172
175
|
attribute :name
|
173
176
|
attribute :address, Address
|
174
177
|
attribute :tags, Array[Tag]
|
@@ -192,10 +195,10 @@ attrs = {
|
|
192
195
|
|
193
196
|
Person.new(attrs).tap do |person|
|
194
197
|
person.name #=> 'John Smith'
|
195
|
-
|
198
|
+
|
196
199
|
person.address.street #=> '123 Main St.'
|
197
200
|
person.address.zip #=> '97213'
|
198
|
-
|
201
|
+
|
199
202
|
person.tags.count #=> 2
|
200
203
|
person.tags.first.name #=> 'Ruby'
|
201
204
|
end
|
@@ -210,7 +213,7 @@ Artisanal::Model can also add writer methods that aren't provided from dry-initi
|
|
210
213
|
|
211
214
|
class Person < Model
|
212
215
|
attribute :name
|
213
|
-
attribute :email, writer: false
|
216
|
+
attribute :email, writer: false
|
214
217
|
attribute :phone, writer: :protected # the same as adding `protected :phone`
|
215
218
|
attribute :age, writer: :private # the same as adding `private :age`
|
216
219
|
end
|
@@ -242,10 +245,10 @@ class Person < Model
|
|
242
245
|
attribute :email
|
243
246
|
attribute :age
|
244
247
|
end
|
245
|
-
|
248
|
+
|
246
249
|
Person.new(name: 'John Smith', email: 'john@example.com', age: '37').tap do |person|
|
247
250
|
person.name #=> 'John Smith'
|
248
|
-
|
251
|
+
|
249
252
|
person.assign_attributes(name: 'Bob Johnson', email: 'bob@example.com')
|
250
253
|
|
251
254
|
person.name #=> 'Bob Johnson'
|
@@ -276,7 +279,7 @@ end
|
|
276
279
|
|
277
280
|
### undefined attributes
|
278
281
|
|
279
|
-
Dry-initializer [differentiates](https://dry-rb.org/gems/dry-initializer/skip-undefined/) between a `nil` value passed in for an attribute and nothing passed in at all.
|
282
|
+
Dry-initializer [differentiates](https://dry-rb.org/gems/dry-initializer/skip-undefined/) between a `nil` value passed in for an attribute and nothing passed in at all.
|
280
283
|
|
281
284
|
This can be turned off through Artisanal::Model for performance reasons if you don't care about the differences between `nil` and undefined. However, if turned on, serializing to a hash will also exclude undefined values by default:
|
282
285
|
|
data/artisanal-model.gemspec
CHANGED
@@ -5,12 +5,12 @@ require "artisanal/model/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "artisanal-model"
|
7
7
|
spec.version = Artisanal::Model::VERSION
|
8
|
-
spec.authors = ["Jared Hoyt, Matthew Peychich"]
|
9
|
-
spec.email = ["jaredhoyt@gmail.com, mpeychich@mac.com"]
|
8
|
+
spec.authors = ["Jared Hoyt, Matthew Peychich", "Nicolas Quintana"]
|
9
|
+
spec.email = ["jaredhoyt@gmail.com, mpeychich@mac.com", "nicolas.quintana@razortech.com.ar"]
|
10
10
|
|
11
|
-
spec.summary = %q{A light attributes wrapper for dry-initializer}
|
12
|
-
spec.description = %q{A light attributes wrapper for dry-initializer}
|
13
|
-
spec.homepage = "https://github.com/
|
11
|
+
spec.summary = %q{A light attributes wrapper for dry-initializer.}
|
12
|
+
spec.description = %q{A light attributes wrapper for dry-initializer. Forked from "https://github.com/goldstar/artisanal-model"}
|
13
|
+
spec.homepage = "https://github.com/stellarlive/artisanal-model"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
# Specify which files should be added to the gem when it is released.
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artisanal-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Hoyt, Matthew Peychich
|
8
|
+
- Nicolas Quintana
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
@@ -122,9 +123,10 @@ dependencies:
|
|
122
123
|
- - "~>"
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '1.2'
|
125
|
-
description: A light attributes wrapper for dry-initializer
|
126
|
+
description: A light attributes wrapper for dry-initializer. Forked from "https://github.com/goldstar/artisanal-model"
|
126
127
|
email:
|
127
128
|
- jaredhoyt@gmail.com, mpeychich@mac.com
|
129
|
+
- nicolas.quintana@razortech.com.ar
|
128
130
|
executables: []
|
129
131
|
extensions: []
|
130
132
|
extra_rdoc_files: []
|
@@ -133,6 +135,7 @@ files:
|
|
133
135
|
- ".gitignore"
|
134
136
|
- ".rspec"
|
135
137
|
- ".travis.yml"
|
138
|
+
- CHANGELOG.md
|
136
139
|
- Gemfile
|
137
140
|
- LICENSE.txt
|
138
141
|
- README.md
|
@@ -150,7 +153,7 @@ files:
|
|
150
153
|
- lib/artisanal/model/initializer.rb
|
151
154
|
- lib/artisanal/model/model.rb
|
152
155
|
- lib/artisanal/model/version.rb
|
153
|
-
homepage: https://github.com/
|
156
|
+
homepage: https://github.com/stellarlive/artisanal-model
|
154
157
|
licenses:
|
155
158
|
- MIT
|
156
159
|
metadata: {}
|
@@ -172,5 +175,5 @@ requirements: []
|
|
172
175
|
rubygems_version: 3.0.3.1
|
173
176
|
signing_key:
|
174
177
|
specification_version: 4
|
175
|
-
summary: A light attributes wrapper for dry-initializer
|
178
|
+
summary: A light attributes wrapper for dry-initializer.
|
176
179
|
test_files: []
|