smart_init 3.4.0 → 3.5.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: '0892f8aa5ed6cba8c888e4a44e67ab3b7fd95fae4648c227593d3ce517fa07f4'
4
- data.tar.gz: 927c461dfc531d9b21d365609b2f86be35a14102fde2bba092f672d8d55a9d16
3
+ metadata.gz: 51e20a618133427922cb386a3469a77420e95eaf2ad9debaf3f7684a1a0f3e35
4
+ data.tar.gz: 7441d3d6e5eec084365e041d1b33885489ffe4126ec6e16d8eefa04a28caab7a
5
5
  SHA512:
6
- metadata.gz: 3de078331f718dc999244841c6e3b2e0321af77e43352fde4593c2b08f45e680f98685480fe7455192d9b2d44e804f610ef3ddd588b810700750d116a3c9b1b6
7
- data.tar.gz: 6523291cb5c8b9a9af044b82ff85c6b2d3c0814a25d506ed2c1d8502b355ba15e33211cd0ebfc45bc859848b7e571a8e83668d5f4d30194970f2c3e452170836
6
+ metadata.gz: 48c99e64ba5e5325b3ea9087be3eff565add93252a7a52efddd2810f6b37d255d98b475e97614d7201009636fe5a1d6070309f0cf2e761e5da8b4de72b0ee313
7
+ data.tar.gz: 2118838699bd2fcd42227041515033d01d790a1d6bcabe44437a0ce95cf0653fbc3c49d42d65a8bc65a708070302df621f79c62e7935d2d1eabd6552cb55f9ec
@@ -28,7 +28,12 @@ module SmartInit
28
28
  end
29
29
 
30
30
  (required_attrs + default_value_attrs.keys).each do |attribute|
31
- value = parameters.first[attribute] || default_value_attrs[attribute]
31
+ value = if parameters.first.has_key?(attribute)
32
+ parameters.first.fetch(attribute)
33
+ else
34
+ default_value_attrs[attribute]
35
+ end
36
+
32
37
  instance_variable_set("@#{attribute}", value)
33
38
  end
34
39
  end
@@ -1,3 +1,3 @@
1
1
  module SmartInit
2
- VERSION = "3.4.0"
2
+ VERSION = "3.5.0"
3
3
  end
data/smart_init.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.description = %q{ A smart DSL for ruby initializers boilerplate }
13
13
  gem.homepage = "http://github.com/pawurb/smart_init"
14
14
  gem.files = `git ls-files`.split("\n")
15
- gem.test_files = gem.files.grep(%r{^(spec)/})
15
+ gem.test_files = gem.files.grep(%r{^(test)/})
16
16
  gem.require_paths = ["lib"]
17
17
  gem.license = "MIT"
18
18
  gem.add_development_dependency "rake"
@@ -76,4 +76,8 @@ class HashApiTest < Test::Unit::TestCase
76
76
  def test_all_defaults
77
77
  assert_equal TestServiceAllDefaults.call, ["default_value_1", "default_value_2", "default_value_3"]
78
78
  end
79
+
80
+ def test_falsey_values
81
+ assert_equal TestService.call(attribute_1: false, attribute_2: nil), [false, nil]
82
+ end
79
83
  end
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: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -80,4 +80,6 @@ rubygems_version: 3.0.3
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Remove Ruby initializer boilerplate code
83
- test_files: []
83
+ test_files:
84
+ - test/test_args_api.rb
85
+ - test/test_hash_api.rb