immutable_struct_ex 0.2.3 → 1.0.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: 1a0a34457a9487fc3f303f5605d59b4b16e31621f7d3a3fdeb6ea3c2cb3df0bb
4
- data.tar.gz: d7e39e8460fac3985e54929ef0ceda6dba990468daaceb666094149a784fbd06
3
+ metadata.gz: 2fce441affccae142eb67911aaecfdf0886a6ea60aa505bb7ee404217ec178d3
4
+ data.tar.gz: b39016ae4dcf0c28c4381d391cb5597f835497b92551459a54ffb3d79331138d
5
5
  SHA512:
6
- metadata.gz: 9d2058c398d2083f608ad57b1b54f9c4a0379a95645a36479bdb02007ef0acfe0560d58576c47bc754dad21830876f027329f163f1326dd3139700967c8aaa0d
7
- data.tar.gz: c222c628b6b35c8ef5598c644460246b4f015e754bf5d65cdc3b3dc045e56a0a4fcf0efc5224f2c626ea0d8c41c65eefcde462f35b179ecd4954581f4dc28c3d
6
+ metadata.gz: 411878a19d161a2784424180a7de70e1f4fdda4d6a115ae3e4af2f54fd0781bf345ea1a51977e0707e1d8a2579bbcd30208ddb782a225679ecbb517cec86e68b
7
+ data.tar.gz: fa0f13ecb0161bf674a24b272a4254c6a957e7b12df10d87adde9127b9b2542b0da4858e8392ba1fe91ab4ddcaecff8ada10e9e50bf5a6eb40626d9659987957
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 1.0.0
2
+ * Changes (not really a breaking change, but just wanted to bump to 1.0.0)
3
+ * Limit required ruby version to ~> 3.0.
4
+ * Update ruby gems.
5
+
6
+ ### 0.3.0
7
+ * Changes
8
+ * Update README.md file with the correct gem name.
9
+
1
10
  ### 0.2.3
2
11
  * Bug fix
3
12
  * Fix bug in specs that failed to add criteria for passing tests (e.g. ".to eq true/false") so tests could not fail.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- immutable_struct_ex (0.2.3)
4
+ immutable_struct_ex (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,50 +17,50 @@ GEM
17
17
  parallel (1.22.1)
18
18
  parser (3.1.2.1)
19
19
  ast (~> 2.4.1)
20
- pry (0.13.1)
20
+ pry (0.14.1)
21
21
  coderay (~> 1.1)
22
22
  method_source (~> 1.0)
23
- pry-byebug (3.9.0)
23
+ pry-byebug (3.10.1)
24
24
  byebug (~> 11.0)
25
- pry (~> 0.13.0)
25
+ pry (>= 0.13, < 0.15)
26
26
  rainbow (3.1.1)
27
27
  rake (13.0.6)
28
28
  reek (6.1.1)
29
29
  kwalify (~> 0.7.0)
30
30
  parser (~> 3.1.0)
31
31
  rainbow (>= 2.0, < 4.0)
32
- regexp_parser (2.5.0)
32
+ regexp_parser (2.6.0)
33
33
  rexml (3.2.5)
34
- rspec (3.11.0)
35
- rspec-core (~> 3.11.0)
36
- rspec-expectations (~> 3.11.0)
37
- rspec-mocks (~> 3.11.0)
38
- rspec-core (3.11.0)
39
- rspec-support (~> 3.11.0)
40
- rspec-expectations (3.11.0)
34
+ rspec (3.12.0)
35
+ rspec-core (~> 3.12.0)
36
+ rspec-expectations (~> 3.12.0)
37
+ rspec-mocks (~> 3.12.0)
38
+ rspec-core (3.12.0)
39
+ rspec-support (~> 3.12.0)
40
+ rspec-expectations (3.12.0)
41
41
  diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.11.0)
43
- rspec-mocks (3.11.1)
42
+ rspec-support (~> 3.12.0)
43
+ rspec-mocks (3.12.0)
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.11.0)
46
- rspec-support (3.11.0)
47
- rubocop (1.35.0)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-support (3.12.0)
47
+ rubocop (1.38.0)
48
48
  json (~> 2.3)
49
49
  parallel (~> 1.10)
50
50
  parser (>= 3.1.2.1)
51
51
  rainbow (>= 2.2.2, < 4.0)
52
52
  regexp_parser (>= 1.8, < 3.0)
53
53
  rexml (>= 3.2.5, < 4.0)
54
- rubocop-ast (>= 1.20.1, < 2.0)
54
+ rubocop-ast (>= 1.23.0, < 2.0)
55
55
  ruby-progressbar (~> 1.7)
56
56
  unicode-display_width (>= 1.4.0, < 3.0)
57
- rubocop-ast (1.21.0)
57
+ rubocop-ast (1.23.0)
58
58
  parser (>= 3.1.1.0)
59
- rubocop-performance (1.14.3)
59
+ rubocop-performance (1.15.0)
60
60
  rubocop (>= 1.7.0, < 2.0)
61
61
  rubocop-ast (>= 0.4.0)
62
- rubocop-rspec (2.12.1)
63
- rubocop (~> 1.31)
62
+ rubocop-rspec (2.15.0)
63
+ rubocop (~> 1.33)
64
64
  ruby-progressbar (1.11.0)
65
65
  simplecov (0.21.2)
66
66
  docile (~> 1.1)
@@ -68,7 +68,7 @@ GEM
68
68
  simplecov_json_formatter (~> 0.1)
69
69
  simplecov-html (0.12.3)
70
70
  simplecov_json_formatter (0.1.4)
71
- unicode-display_width (2.2.0)
71
+ unicode-display_width (2.3.0)
72
72
 
73
73
  PLATFORMS
74
74
  x86_64-darwin-19
@@ -86,4 +86,4 @@ DEPENDENCIES
86
86
  simplecov (~> 0.21.2)
87
87
 
88
88
  BUNDLED WITH
89
- 2.3.20
89
+ 2.3.22
data/README.md CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  [![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
10
10
 
11
- # ImmutableStructEx
11
+ # immutable_struct_ex
12
12
 
13
- _ImmutableStructEx_ is yet another immutable struct. What makes ImmutableStructEx different, is that it allows you to create immutable structs in one step _by default_. In other words, other immutable struct gems force you to first define the struct, then instantiate the struct object; or, define the struct and instantiate the struct object via chaining. For example:
13
+ immutable_struct_ex is yet another immutable struct. What makes immutable_struct_ex different, is that it allows you to create immutable structs in one step _by default_. In other words, other immutable struct gems force you to first define the struct, then instantiate the struct object; or, define the struct and instantiate the struct object via chaining. For example:
14
14
 
15
15
  ## Other Immutable Structs
16
16
 
@@ -24,31 +24,38 @@ some_immutable_struct = SomeImmutableStruct.new(:first, :last, :phone)
24
24
  .new(first: 'John', last: 'Doe', phone: '(201) 230-7281')
25
25
  ```
26
26
 
27
- ## ImmutableStructEx
28
- ImmutableStructEx allows you do this in one step:
27
+ ## immutable_struct_ex
28
+ immutable_struct_ex allows you to instantiate and initialize the object _in one step:_
29
29
 
30
30
  ```ruby
31
31
  immutable_struct_ex = ImmutableStructEx.new(first: 'John', last: 'Doe', phone: '(201) 230-7281')
32
+
32
33
  immutable_struct_ex.first
33
34
  #=> 'John'
35
+
34
36
  immutable_struct_ex[:first]
35
37
  #=> 'John'
38
+
36
39
  immutable_struct_ex.last
37
40
  #=> 'Doe'
41
+
38
42
  immutable_struct_ex.phone
39
43
  #=> '(201) 230-7281'
40
44
  ```
41
45
  ### Immutable
42
- Like other immutable structs, ImmutableStructEx also removes methods that change the state of the object:
46
+ Like other immutable structs, immutable_struct_ex also removes methods that change the state of the object, making it _immutable:_
47
+
43
48
  ```ruby
44
49
  immutable_struct_ex.first = 'Joe'
45
50
  #=> NoMethodError: undefined method `first='...
51
+
46
52
  immutable_struct_ex[:first] = 'Joe'
47
53
  #=> NoMethodError: undefined method `[]='...
48
54
  ```
49
55
 
50
56
  ### Blocks
51
- Also, not unlike other immutable structs, ImmutableStructEx also allows you to pass a block:
57
+ Also, not unlike other immutable structs, immutable_struct_ex also allows you to pass a block:
58
+
52
59
  ```ruby
53
60
  # With a block
54
61
  immutable_struct_ex = ImmutableStructEx.new(first: 'John', last: 'Doe', phone: '(201) 230-7281') do
@@ -56,14 +63,22 @@ immutable_struct_ex = ImmutableStructEx.new(first: 'John', last: 'Doe', phone: '
56
63
  first == 'John'
57
64
  end
58
65
  end
66
+
59
67
  immutable_struct_ex.john?
60
68
  #=> true
61
69
  ```
62
70
 
63
71
  ### Other Examples
72
+ Get creative. Below is an example of an immutable struct that provides _redaction_:
73
+
64
74
  ```ruby
65
75
  # Redactable, immutable struct
66
- user = { username: 'jdoe', password: 'p@55w0rD', ssn: '123-70-9182' }
76
+ user = {
77
+ username: 'jdoe',
78
+ password: 'p@55w0rD',
79
+ ssn: '123-70-9182'
80
+ }
81
+
67
82
  immutable_struct_ex = ImmutableStructEx.new(**user) do
68
83
  REDACT = %i(password ssn).freeze
69
84
 
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = 'Creates an immutable struct in one step.'
15
15
  spec.homepage = 'https://github.com/gangelo/immutable_struct_ex'
16
16
  spec.license = 'MIT'
17
- spec.required_ruby_version = '>= 3.0.1'
17
+ spec.required_ruby_version = Gem::Requirement.new("~> 3.0")
18
18
 
19
19
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
20
20
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImmutableStructEx
4
- VERSION = '0.2.3'
4
+ VERSION = '1.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immutable_struct_ex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gene M. Angelo, Jr.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2022-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -203,16 +203,16 @@ require_paths:
203
203
  - lib
204
204
  required_ruby_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 3.0.1
208
+ version: '3.0'
209
209
  required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  requirements:
211
211
  - - ">="
212
212
  - !ruby/object:Gem::Version
213
213
  version: '0'
214
214
  requirements: []
215
- rubygems_version: 3.2.15
215
+ rubygems_version: 3.3.22
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: Creates an immutable struct in one step.