ez_attributes 0.1.0 → 0.2.0

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: e1a1656644b5f4125ced596740a565eb787d9c55d9a355cf819f6064707edd3d
4
- data.tar.gz: f4ac601d6787ac40cee85efbc1fafe3f8664fbf5fbf90efc53ba0a92652bd30e
3
+ metadata.gz: e224050f286e539088db94bd4f7e0fa0b85c6bab41a9cc7a9a5c95fe85db0e95
4
+ data.tar.gz: dafea4c75d5c805e903b77cbd0bf37442a267086e2279a6c99a361b83b7b9aee
5
5
  SHA512:
6
- metadata.gz: aedc2203f94400db3327994c3b568e3d2e419b61429dec040ccb4b7bf932ced79433e2c07db92ae2c75c223ac73198c8061e7da6754b91031cf45227a3ad864c
7
- data.tar.gz: 81bc482c0f146b8e95a666e1bf2e4631eeaaa7b9ed18dd120b1a473ccf7796232ef24db28537b44c147ef1d27d97d3ff2ce3ba1bfc70c64b2607233398477521
6
+ metadata.gz: 6019b8a0eafd24e8d3f4ba59561a36e45d5f416ae28868eb67477aafacd98c9da1f4166c82594fa4759a587c161fbfaea4c7d19767d166b242f0e957b3461d28
7
+ data.tar.gz: 25679ef9004940eedb30a9f330d790ac308ad7aca4e4501522689a5a76bbadf47203812d4ae63da325976dcf8fd1709b052d8cc2f0cbc5fa0bca59805e674474
@@ -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
- ## <!-- ### Removed -->
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
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ez_attributes (0.1.0)
4
+ ez_attributes (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -89,4 +89,4 @@ DEPENDENCIES
89
89
  yard
90
90
 
91
91
  BUNDLED WITH
92
- 2.1.4
92
+ 2.2.6
@@ -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.1.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} = #{name}" }.join('; ')}
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.1.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: 2020-11-25 00:00:00.000000000 Z
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.