ez_attributes 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e224050f286e539088db94bd4f7e0fa0b85c6bab41a9cc7a9a5c95fe85db0e95
4
- data.tar.gz: dafea4c75d5c805e903b77cbd0bf37442a267086e2279a6c99a361b83b7b9aee
3
+ metadata.gz: 3725aa929024853d9ba191e9483c4fba92c6b1e48e9b85eeea3fdfcdc05d7273
4
+ data.tar.gz: 82389ab1902d37420d0667c63f0c1c68b907f4c4e21905aac64751cd9db7c312
5
5
  SHA512:
6
- metadata.gz: 6019b8a0eafd24e8d3f4ba59561a36e45d5f416ae28868eb67477aafacd98c9da1f4166c82594fa4759a587c161fbfaea4c7d19767d166b242f0e957b3461d28
7
- data.tar.gz: 25679ef9004940eedb30a9f330d790ac308ad7aca4e4501522689a5a76bbadf47203812d4ae63da325976dcf8fd1709b052d8cc2f0cbc5fa0bca59805e674474
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: actions/setup-ruby@v1
19
+ uses: ruby/setup-ruby@v1
20
20
  with:
21
21
  ruby-version: ${{ matrix.ruby }}
22
22
  - name: Build and test with Rake
@@ -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.0...HEAD
39
- [0.1.0]: https://github.com/MatheusRich/ez_attributes/releases/tag/v0.1.0
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ez_attributes (0.2.0)
4
+ ez_attributes (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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.0'
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.0
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-19 00:00:00.000000000 Z
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.