ez_attributes 0.1.0 → 0.2.0
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 +18 -1
- data/Gemfile.lock +2 -2
- data/lib/ez_attributes.rb +2 -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: e224050f286e539088db94bd4f7e0fa0b85c6bab41a9cc7a9a5c95fe85db0e95
|
4
|
+
data.tar.gz: dafea4c75d5c805e903b77cbd0bf37442a267086e2279a6c99a361b83b7b9aee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6019b8a0eafd24e8d3f4ba59561a36e45d5f416ae28868eb67477aafacd98c9da1f4166c82594fa4759a587c161fbfaea4c7d19767d166b242f0e957b3461d28
|
7
|
+
data.tar.gz: 25679ef9004940eedb30a9f330d790ac308ad7aca4e4501522689a5a76bbadf47203812d4ae63da325976dcf8fd1709b052d8cc2f0cbc5fa0bca59805e674474
|
data/CHANGELOG.md
CHANGED
@@ -7,10 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
|
10
11
|
<!-- ### Added -->
|
11
12
|
<!-- ### Changed -->
|
13
|
+
<!-- ### Removed -->
|
14
|
+
|
15
|
+
## [0.2.0] - 2021-01-19
|
16
|
+
|
17
|
+
### Added
|
18
|
+
|
19
|
+
- Allow using reserved words as attributes.
|
20
|
+
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
Class.new do
|
24
|
+
extend EzAttributes
|
12
25
|
|
13
|
-
|
26
|
+
# This would break in 0.1.0.
|
27
|
+
# Now it works.
|
28
|
+
attributes :class, :if
|
29
|
+
end
|
30
|
+
```
|
14
31
|
|
15
32
|
## [0.1.0] - 2020-11-24
|
16
33
|
|
data/Gemfile.lock
CHANGED
data/lib/ez_attributes.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# => #<User:0x000055bac152f130 @name="Matheus", @age=22, @email="guest@user.com">
|
16
16
|
module EzAttributes
|
17
17
|
# Gem version
|
18
|
-
VERSION = '0.
|
18
|
+
VERSION = '0.2.0'
|
19
19
|
|
20
20
|
# Defines multiple keyword arguments for a class initializer
|
21
21
|
def attributes(*args, **args_with_default)
|
@@ -31,7 +31,7 @@ module EzAttributes
|
|
31
31
|
|
32
32
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
33
33
|
def initialize(#{init_args})
|
34
|
-
#{all_args.map { |name| "@#{name} =
|
34
|
+
#{all_args.map { |name| "@#{name} = binding.local_variable_get(:#{name})" }.join('; ')}
|
35
35
|
end
|
36
36
|
RUBY
|
37
37
|
end
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matheus Richard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 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.
|