u-attributes 1.1.0 → 1.1.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: a9b3e7bb30f3fc6eb465c26378b99146dc3762f191f8554220bad22fd760cd21
4
- data.tar.gz: 3c8de349ac5e966911877ca5c71f00ac5471f8b838323dd52b85a59e05b686a1
3
+ metadata.gz: 854cdfcbae1f568640947a0bbfdf5fa26493a1e47ebf29ce91d7d287f6388050
4
+ data.tar.gz: df775cef424add3e18672d03b6522d5e625b6e211b6891078b7bfb31e2ba996a
5
5
  SHA512:
6
- metadata.gz: 14fbd07d3cbc6e31293417dba289b8bd91e0c4c1de7d74692f9b5498f7e016dcb4463ef70f0e6ff94e703e6e87ea514bbbd4ad36cf566367d2785533578f2e0c
7
- data.tar.gz: ca9669124566003aad1d5cc520b9dcab7ec866a170b2561908a49eb8c236746352827e7fe65354584cd42120435ba7dde4723046dc6fc8d124491db000a885d1
6
+ metadata.gz: 6541f9295ae0cc88fec1fcc05d8307feb05769de3aadfb597710517aa76e80dacaef7fd2d165491319ef2b0e701c20ebd025459befa2e5c92f07da43f5df6f3b
7
+ data.tar.gz: 04e200e16d8c6258e819baa9b3f0ef00c86fc1715d6a866c6dc05fcefde54ceb7fd4746fa050e4e7b50ae7360dcd4639a2397ffe837593107368e19bfcef0dad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u-attributes (1.1.0)
4
+ u-attributes (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,8 +32,7 @@ module Micro
32
32
  'activemodel_validations:initialize' => With::ActiveModelValidationsAndInitialize,
33
33
  'activemodel_validations:strict_initialize' => With::ActiveModelValidationsAndStrictInitialize,
34
34
  'activemodel_validations:diff:initialize' => With::ActiveModelValidationsAndDiffAndInitialize,
35
- 'activemodel_validations:diff:strict_initialize' => With::ActiveModelValidationsAndDiffAndStrictInitialize,
36
- ALL.join(':') => With::ActiveModelValidationsAndDiffAndStrictInitialize
35
+ 'activemodel_validations:diff:strict_initialize' => With::ActiveModelValidationsAndDiffAndStrictInitialize
37
36
  }.freeze
38
37
 
39
38
  private_constant :OPTIONS, :INVALID_NAME
@@ -44,6 +43,8 @@ module Micro
44
43
 
45
44
  def with(args)
46
45
  valid_names!(args) do |names|
46
+ delete_initialize_if_has_strict_initialize(names)
47
+
47
48
  OPTIONS.fetch(names.sort.join(':'))
48
49
  end
49
50
  end
@@ -80,22 +81,21 @@ module Micro
80
81
  yield(names)
81
82
  end
82
83
 
83
- def has_strict_initialize?(names)
84
- names.include?(STRICT_INITIALIZE)
84
+ def an_initialize?(name)
85
+ name == INITIALIZE || name == STRICT_INITIALIZE
85
86
  end
86
87
 
87
- def any_kind_of_initialize?(names)
88
- names.include?(INITIALIZE) || has_strict_initialize?(names)
89
- end
88
+ def delete_initialize_if_has_strict_initialize(names)
89
+ return unless names.include?(STRICT_INITIALIZE)
90
90
 
91
- def an_initialize?(name)
92
- name == INITIALIZE || name == STRICT_INITIALIZE
91
+ names.delete_if { |name| name == INITIALIZE }
93
92
  end
94
93
 
95
94
  def except_options(names_to_exclude)
96
95
  (ALL - names_to_exclude).tap do |names|
97
- names.delete_if { |name| an_initialize?(name) } if any_kind_of_initialize?(names_to_exclude)
98
- names.delete_if { |name| name == INITIALIZE } if has_strict_initialize?(names)
96
+ names.delete_if { |name| an_initialize?(name) } if names_to_exclude.include?(INITIALIZE)
97
+
98
+ delete_initialize_if_has_strict_initialize(names)
99
99
  end
100
100
  end
101
101
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Micro
4
4
  module Attributes
5
- VERSION = '1.1.0'.freeze
5
+ VERSION = '1.1.1'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u-attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.0.3
78
+ rubygems_version: 3.0.1
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Define read-only attributes