ez_attributes 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/.github/workflows/tests-and-linter.yml +2 -2
- data/CHANGELOG.md +10 -4
- data/Gemfile.lock +1 -1
- data/lib/ez_attributes.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3725aa929024853d9ba191e9483c4fba92c6b1e48e9b85eeea3fdfcdc05d7273
|
4
|
+
data.tar.gz: 82389ab1902d37420d0667c63f0c1c68b907f4c4e21905aac64751cd9db7c312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2107ab21f2840cb891dc8a82a3bb316312f2c15729b5987fec7e455463d441dc2c34d17b9b47fc158e73e11f0827ecd5450de28f4840202b92ba58f92c193dfc
|
7
|
+
data.tar.gz: 30198452e4e6e4209d0f97211c15c5b50cbde8341d198c4e087101ba8e23cb53c6716154db855f72f8f06473d7a71b3f8a2abe19ce55e7aa74014a42f8398e62
|
@@ -11,12 +11,12 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby: [2.5, 2.6, 2.7]
|
14
|
+
ruby: [2.5, 2.6, 2.7, '3.0']
|
15
15
|
|
16
16
|
steps:
|
17
17
|
- uses: actions/checkout@v2
|
18
18
|
- name: Set up Ruby ${{ matrix.ruby }}
|
19
|
-
uses:
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.ruby }}
|
22
22
|
- name: Build and test with Rake
|
data/CHANGELOG.md
CHANGED
@@ -7,18 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
-
|
11
10
|
<!-- ### Added -->
|
12
11
|
<!-- ### Changed -->
|
13
12
|
<!-- ### Removed -->
|
14
13
|
|
14
|
+
## [0.2.1] - 2021-01-20
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- Do not generate getter for attribute named `class`. This prevents overriding the `Object#class` method.
|
19
|
+
|
15
20
|
## [0.2.0] - 2021-01-19
|
16
21
|
|
17
22
|
### Added
|
18
23
|
|
19
24
|
- Allow using reserved words as attributes.
|
20
25
|
|
21
|
-
|
22
26
|
```ruby
|
23
27
|
Class.new do
|
24
28
|
extend EzAttributes
|
@@ -35,5 +39,7 @@ end
|
|
35
39
|
|
36
40
|
- Basic module to define class initializers with keyword args.
|
37
41
|
|
38
|
-
[unreleased]: https://github.com/MatheusRich/ez_attributes/compare/v0.1
|
39
|
-
[0.1
|
42
|
+
[unreleased]: https://github.com/MatheusRich/ez_attributes/compare/v0.2.1...HEAD
|
43
|
+
[0.2.1]: https://github.com/MatheusRich/ez_attributes/releases/tag/v0.2.1
|
44
|
+
[0.2.0]: https://github.com/MatheusRich/ez_attributes/releases/tag/v0.2.0
|
45
|
+
[0.1.0]: https://github.com/MatheusRich/ez_attributes/releases/tag/v0.2.0
|
data/Gemfile.lock
CHANGED
data/lib/ez_attributes.rb
CHANGED
@@ -15,7 +15,10 @@
|
|
15
15
|
# => #<User:0x000055bac152f130 @name="Matheus", @age=22, @email="guest@user.com">
|
16
16
|
module EzAttributes
|
17
17
|
# Gem version
|
18
|
-
VERSION = '0.2.
|
18
|
+
VERSION = '0.2.1'
|
19
|
+
|
20
|
+
# Attributes that won't have a getter to prevent conflicts with default methods
|
21
|
+
EXCEPTIONS = [:class].freeze
|
19
22
|
|
20
23
|
# Defines multiple keyword arguments for a class initializer
|
21
24
|
def attributes(*args, **args_with_default)
|
@@ -27,7 +30,7 @@ module EzAttributes
|
|
27
30
|
private :__args_with_default
|
28
31
|
|
29
32
|
all_args = args + args_with_default.keys
|
30
|
-
attr_reader(*all_args)
|
33
|
+
attr_reader(*(all_args - EXCEPTIONS))
|
31
34
|
|
32
35
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
33
36
|
def initialize(#{init_args})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez_attributes
|
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
|
- Matheus Richard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easily define initializers with keyword args. It supports required and
|
14
14
|
optional args.
|