smart_init 5.0.0 → 5.0.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: e98d279fac333ac355c8d854d724c567151dd9798d11cf248f50e75edc1ebdc0
4
- data.tar.gz: 517a005cd94b3841e6f212c4368034c220aff25c1e73410e884445397bc5da34
3
+ metadata.gz: 6a6053427e61f4ef731105e0ec9a96799333b652b82c44b875900d61a1a6a1b3
4
+ data.tar.gz: eb2559ca73adcfe8ad893e9fcf8510ed2bb29229331add6d5f5cdb41b6c99d9e
5
5
  SHA512:
6
- metadata.gz: 98a3581a564a6ffc532c52540c4942d2b103b3d0bec9d5511e40e0fc57c6dd775bfb79ddcfa9d2e3acf0616ab8b4c724fc50ce173658cc63d14aff230667d3b0
7
- data.tar.gz: f789ca9f6b424fc6b77f519ef90564d08ac85eb937ac11e77856cb2a41c1f41f12fc825f450d114ef8bf8d7c24f6dacd92ba9cbbad5e5c7944022a05ecc868c1
6
+ metadata.gz: c36fb8e29eb8f2d78814ed27059bbbe5c5d0f828a97421565f47ac8bbea7e153f70407c589a4576dfc6aba2d238b7d2cba51526ac7343c52fccd47d891dfb86f
7
+ data.tar.gz: 3c9b8cc59befe99ea87afc76ec287a4d56a2696b557cb30b2854de9f24a4c79bf1ffdd309e6aacd9317c0a5da95d7c4af8c75200e092a74a0d6b6a56c984906c
@@ -17,8 +17,8 @@ module SmartInit
17
17
  public_readers = attributes_and_options.delete(:public_readers) || []
18
18
  public_accessors = attributes_and_options.delete(:public_accessors) || []
19
19
  if public_readers == true || public_accessors == true
20
- public_readers = required_attrs
21
- public_accessors = required_attrs if public_accessors == true
20
+ public_readers = required_attrs + attributes_and_options.keys
21
+ public_accessors = required_attrs + attributes_and_options.keys if public_accessors == true
22
22
  else
23
23
  public_readers += public_accessors
24
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartInit
4
- VERSION = "5.0.0"
4
+ VERSION = "5.0.1"
5
5
  end
@@ -33,6 +33,15 @@ class TestDefaultPublic
33
33
  end
34
34
  end
35
35
 
36
+ class TestDefaultAllPublic
37
+ extend SmartInit
38
+ initialize_with :attribute_1, attribute_2: 2, public_readers: true
39
+
40
+ def call
41
+ [attribute_1, attribute_2]
42
+ end
43
+ end
44
+
36
45
  class HashApiPublicTest < Test::Unit::TestCase
37
46
  def test_all_public
38
47
  service = TestAllPublic.new(attribute_1: "a", attribute_2: "b")
@@ -56,5 +65,11 @@ class HashApiPublicTest < Test::Unit::TestCase
56
65
  service.attribute_1
57
66
  end
58
67
  end
68
+
69
+ def test_default_all_public
70
+ service = TestDefaultAllPublic.new(attribute_1: "a")
71
+ assert_equal service.attribute_1, "a"
72
+ assert_equal service.attribute_2, 2
73
+ end
59
74
  end
60
75
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_init
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-10 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.1.2
95
+ rubygems_version: 3.1.6
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Remove Ruby initializer boilerplate code