quick_class 1.0.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b3093c16f9af3bb3e33f49141d5c1228ff65dd2f9adf157d4d7d2227b0959c0
4
- data.tar.gz: 2f421209b547fc473d15b40e309d30ebbcae4b3d7c73e27e0b6b1605407982d1
3
+ metadata.gz: 9b7f9fa6755b194bd8b04a6fbcadc52e2c1b760d3e3472ab35b6d085e9f59962
4
+ data.tar.gz: d43a140c80cca2b630bc58d4a2a580ec86452e5b80366074cc86348a4e3775e4
5
5
  SHA512:
6
- metadata.gz: f48ab120ab0f22213b54bfd7a92b10bad4e64bc52ed66b590d0f9e55d653ae042115a8055347964702a90e68f835d2716251b5c0a8279c980ee6e627d49102ba
7
- data.tar.gz: da3759670d7f7d63e6d123972c5853dc049c78c85aff7c314d6d1ef3ff9c610dd59d106ac710d92ccb4525c0294e73112da2dfcdabb2b7e4d64866a24ba3947c
6
+ metadata.gz: 327f9f30def3722ae3b1c88ecdbcf7b5998dd575aa64d868eeae056f1bcc9481aabe56831681bf16f7e3af5cb102a8ea5b9f1d014e8544c1c008c665a0bab301
7
+ data.tar.gz: b7918f5f13ce0920cdc5148d21dfb131ac3d7ff04a1f32e7a10f6d787ebb17b95196ae63647c74bd12099d9462be61200f9352db583d9a9bb2f0322e22a0811c
data/README.md CHANGED
@@ -38,7 +38,7 @@ The `default` method is also defined, which is the same as passing `attributes`
38
38
 
39
39
  ```
40
40
  Foo.default
41
- # => #<Foo:0x007fef7398f6b0 @a=0, @b=2>
41
+ # => #<Foo:0x007fef7398f6b0 @a=0, @b=1>
42
42
  ```
43
43
 
44
44
  It works with interitance also:
@@ -73,6 +73,6 @@ Foo.default.b
73
73
  # => 1
74
74
  ```
75
75
 
76
- The whole source code is about 15 un-minified lines without comments.
76
+ The whole source code is 12 un-minified lines without comments.
77
77
 
78
78
  use at own risk
data/lib/quick_class.rb CHANGED
@@ -3,9 +3,7 @@ class QuickClass
3
3
  # main public method - define attributes for a class
4
4
  def self.attributes=(**keyvals)
5
5
  # if attributes is already defined, delete the attr_accessor methods
6
- @attributes&.each_key do |k|
7
- [:"#{k}", :"#{k}="].each { |m| send :undef_method, m }
8
- end
6
+ @attributes&.each_key { |k| [:"#{k}", :"#{k}="].each &method(:undef_method) }
9
7
  # define attributes at the keyvals passed to this method as an argument,
10
8
  # merged with the attributes of the superclass, if there is one.
11
9
  @attributes = keyvals.merge(superclass&.attributes || {})
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QuickClass
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quick_class
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - max pleaner