immutable_struct_ex 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b6899b83fdcbc4b1667c1e4f52d5684f02951906db7edb8803cddc3aafdd13f4
4
+ data.tar.gz: 71d5b7273ac7957ff121a8a5956c464eeb6d6fc406e401d140bcfd011a9b7938
5
+ SHA512:
6
+ metadata.gz: c6984a42cc429d6670cc27575c3454fc697f71632d9f79216fadd12972df49c1ec4c0ac2f7f80a773e8c871bc32c7a76ae7dfcd245f50dbd8decba7bdbccb20c
7
+ data.tar.gz: d016604712962f74e086a4af92488762c2f66a4f106d85c650430067077ebfbbc71cc32ed1d0d233d79be8a7bf8632bb5d3bb5b82a275d625814a97882b9b9a2
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ /rdoc/
11
+ *.gem
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
15
+
16
+ *.code-workspace
17
+
18
+ scratch.rb
19
+ readme.txt
data/.reek.yml ADDED
@@ -0,0 +1,18 @@
1
+ exclude_paths:
2
+ - vendor
3
+ - spec
4
+ detectors:
5
+ # TooManyInstanceVariables:
6
+ # exclude:
7
+ # - "Class1"
8
+ # - "Class2"
9
+ # private methods do not have to depend on instance state
10
+ # https://github.com/troessner/reek/blob/master/docs/Utility-Function.md
11
+ UtilityFunction:
12
+ public_methods_only: true
13
+ # Check for variable name that doesn't communicate its intent well enough
14
+ # https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md
15
+ UncommunicativeVariableName:
16
+ accept:
17
+ - /^_$/
18
+ - /^e$/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,198 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
2
+ # configuration file. It makes it possible to enable/disable
3
+ # certain cops (checks) and to alter their behavior if they accept
4
+ # any parameters. The file can be placed either in your home
5
+ # directory or in some project directory.
6
+ #
7
+ # RuboCop will start looking for the configuration file in the directory
8
+ # where the inspected file is and continue its way up to the root directory.
9
+ #
10
+ # See https://docs.rubocop.org/rubocop/configuration
11
+ require:
12
+ - rubocop-performance
13
+ - rubocop-rspec
14
+
15
+ AllCops:
16
+ TargetRubyVersion: 3.0.1
17
+ NewCops: enable
18
+ Exclude:
19
+ - '.git/**/*'
20
+ - '.idea/**/*'
21
+ - 'init/*'
22
+ - 'Rakefile'
23
+ - '*.gemspec'
24
+ - 'spec/**/*'
25
+ - 'vendor/**/*'
26
+ - 'scratch.rb'
27
+
28
+ # Align the elements of a hash literal if they span more than one line.
29
+ Layout/HashAlignment:
30
+ EnforcedLastArgumentHashStyle: always_ignore
31
+
32
+ # Alignment of parameters in multi-line method definition.
33
+ # The `with_fixed_indentation` style aligns the following lines with one
34
+ # level of indentation relative to the start of the line with the method
35
+ # definition.
36
+ #
37
+ # def my_method(a,
38
+ # b)
39
+ Layout/ParameterAlignment:
40
+ EnforcedStyle: with_fixed_indentation
41
+
42
+ # Alignment of parameters in multi-line method call.
43
+ # The `with_fixed_indentation` style aligns the following lines with one
44
+ # level of indentation relative to the start of the line with the method call.
45
+ #
46
+ # my_method(a,
47
+ # b)
48
+ Layout/ArgumentAlignment:
49
+ EnforcedStyle: with_fixed_indentation
50
+
51
+ # a = case n
52
+ # when 0
53
+ # x * 2
54
+ # else
55
+ # y / 3
56
+ # end
57
+ Layout/CaseIndentation:
58
+ EnforcedStyle: end
59
+
60
+ # Enforces a configured order of definitions within a class body
61
+ Layout/ClassStructure:
62
+ Enabled: true
63
+
64
+ # Align `end` with the matching keyword or starting expression except for
65
+ # assignments, where it should be aligned with the LHS.
66
+ Layout/EndAlignment:
67
+ EnforcedStyleAlignWith: variable
68
+ AutoCorrect: true
69
+
70
+ # The `consistent` style enforces that the first element in an array
71
+ # literal where the opening bracket and the first element are on
72
+ # seprate lines is indented the same as an array literal which is not
73
+ # defined inside a method call.
74
+ Layout/FirstArrayElementIndentation:
75
+ EnforcedStyle: consistent
76
+
77
+ # The `consistent` style enforces that the first key in a hash
78
+ # literal where the opening brace and the first key are on
79
+ # seprate lines is indented the same as a hash literal which is not
80
+ # defined inside a method call.
81
+ Layout/FirstHashElementIndentation:
82
+ EnforcedStyle: consistent
83
+
84
+ # Indent multi-line methods instead of aligning with periods
85
+ Layout/MultilineMethodCallIndentation:
86
+ EnforcedStyle: indented
87
+
88
+ # Allow `debug` in tasks for now
89
+ Lint/Debugger:
90
+ Exclude:
91
+ - 'RakeFile'
92
+
93
+ # A calculated magnitude based on number of assignments, branches, and
94
+ # conditions.
95
+ # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
96
+ # complaints
97
+ Metrics/AbcSize:
98
+ Enabled: false
99
+
100
+ # Avoid long blocks with many lines.
101
+ Metrics/BlockLength:
102
+ Exclude:
103
+ - 'RakeFile'
104
+ - 'db/seeds.rb'
105
+ - 'spec/**/*.rb'
106
+
107
+ # Avoid classes longer than 100 lines of code.
108
+ # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
109
+ # complaints
110
+ Metrics/ClassLength:
111
+ Max: 200
112
+ Exclude:
113
+ - 'spec/**/*.rb'
114
+
115
+ # A complexity metric that is strongly correlated to the number of test cases
116
+ # needed to validate a method.
117
+ Metrics/CyclomaticComplexity:
118
+ Max: 9
119
+
120
+ # Limit lines to 80 characters
121
+ Layout/LineLength:
122
+ Exclude:
123
+ - 'RakeFile'
124
+ - 'spec/**/*.rb'
125
+
126
+ # Avoid methods longer than 15 lines of code.
127
+ Metrics/MethodLength:
128
+ Max: 20
129
+ IgnoredMethods:
130
+ - swagger_path
131
+ - operation
132
+
133
+
134
+ # A complexity metric geared towards measuring complexity for a human reader.
135
+ Metrics/PerceivedComplexity:
136
+ Max: 10
137
+
138
+ # Naming/FileName:
139
+ # Exclude:
140
+ # - 'lib/file.rb'
141
+
142
+ # Allow `downcase == ` instead of forcing `casecmp`
143
+ Performance/Casecmp:
144
+ Enabled: false
145
+
146
+ # Require children definitions to be nested or compact in classes and modules
147
+ Style/ClassAndModuleChildren:
148
+ Enabled: false
149
+
150
+ # Document classes and non-namespace modules.
151
+ # (Disabled for now, may revisit later)
152
+ Style/Documentation:
153
+ Enabled: false
154
+
155
+ # Checks the formatting of empty method definitions.
156
+ Style/EmptyMethod:
157
+ EnforcedStyle: expanded
158
+
159
+ # Add the frozen_string_literal comment to the top of files to help transition
160
+ # to frozen string literals by default.
161
+ Style/FrozenStringLiteralComment:
162
+ EnforcedStyle: always
163
+
164
+ # Check for conditionals that can be replaced with guard clauses
165
+ Style/GuardClause:
166
+ Enabled: false
167
+
168
+ Style/MixinUsage:
169
+ Exclude:
170
+ - 'RakeFile'
171
+
172
+ # Avoid multi-line method signatures.
173
+ Style/MultilineMethodSignature:
174
+ Enabled: true
175
+
176
+ # Don't use option hashes when you can use keyword arguments.
177
+ Style/OptionHash:
178
+ Enabled: true
179
+
180
+ # Use return instead of return nil.
181
+ Style/ReturnNil:
182
+ Enabled: true
183
+
184
+ # Allow code like `return x, y` as it's occasionally handy.
185
+ Style/RedundantReturn:
186
+ AllowMultipleReturnValues: true
187
+
188
+ # Prefer symbols instead of strings as hash keys.
189
+ Style/StringHashKeys:
190
+ Enabled: true
191
+
192
+ # Checks if configured preferred methods are used over non-preferred.
193
+ Style/StringMethods:
194
+ Enabled: true
195
+
196
+ # Checks for use of parentheses around ternary conditions.
197
+ Style/TernaryParentheses:
198
+ EnforcedStyle: require_parentheses_when_complex
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.1
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at web.gma@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in immutable_struct_ex.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,88 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ immutable_struct_ex (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ byebug (11.1.3)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.5.0)
13
+ docile (1.4.0)
14
+ kwalify (0.7.2)
15
+ method_source (1.0.0)
16
+ parallel (1.22.1)
17
+ parser (3.1.2.1)
18
+ ast (~> 2.4.1)
19
+ pry (0.13.1)
20
+ coderay (~> 1.1)
21
+ method_source (~> 1.0)
22
+ pry-byebug (3.9.0)
23
+ byebug (~> 11.0)
24
+ pry (~> 0.13.0)
25
+ rainbow (3.1.1)
26
+ rake (10.5.0)
27
+ reek (6.1.1)
28
+ kwalify (~> 0.7.0)
29
+ parser (~> 3.1.0)
30
+ rainbow (>= 2.0, < 4.0)
31
+ regexp_parser (2.5.0)
32
+ rexml (3.2.5)
33
+ rspec (3.11.0)
34
+ rspec-core (~> 3.11.0)
35
+ rspec-expectations (~> 3.11.0)
36
+ rspec-mocks (~> 3.11.0)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.0)
46
+ rubocop (1.9.1)
47
+ parallel (~> 1.10)
48
+ parser (>= 3.0.0.0)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.8, < 3.0)
51
+ rexml
52
+ rubocop-ast (>= 1.2.0, < 2.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 3.0)
55
+ rubocop-ast (1.21.0)
56
+ parser (>= 3.1.1.0)
57
+ rubocop-performance (1.14.3)
58
+ rubocop (>= 1.7.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
60
+ rubocop-rspec (2.4.0)
61
+ rubocop (~> 1.0)
62
+ rubocop-ast (>= 1.1.0)
63
+ ruby-progressbar (1.11.0)
64
+ simplecov (0.21.2)
65
+ docile (~> 1.1)
66
+ simplecov-html (~> 0.11)
67
+ simplecov_json_formatter (~> 0.1)
68
+ simplecov-html (0.12.3)
69
+ simplecov_json_formatter (0.1.4)
70
+ unicode-display_width (2.2.0)
71
+
72
+ PLATFORMS
73
+ x86_64-darwin-19
74
+
75
+ DEPENDENCIES
76
+ bundler (~> 2.3.0)
77
+ immutable_struct_ex!
78
+ pry-byebug (~> 3.9)
79
+ rake (~> 10.0)
80
+ reek (~> 6.0, >= 6.0.4)
81
+ rspec (~> 3.0)
82
+ rubocop (~> 1.9.1)
83
+ rubocop-performance (~> 1.11, >= 1.11.3)
84
+ rubocop-rspec (~> 2.3)
85
+ simplecov (~> 0.21.2)
86
+
87
+ BUNDLED WITH
88
+ 2.3.20
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 gangelo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # ImmutableStructEx
2
+
3
+ _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:
4
+
5
+ ## Other Immutable Structs
6
+
7
+ ```ruby
8
+ # Two steps...
9
+ some_immutable_struct = SomeImmutableStruct.new(:first, :last, :phone)
10
+ some_immutable_struct.new(first: 'John', last: 'Doe', phone: '(201) 230-7281')
11
+
12
+ # Chaining...
13
+ some_immutable_struct = SomeImmutableStruct.new(:first, :last, :phone)
14
+ .new(first: 'John', last: 'Doe', phone: '(201) 230-7281')
15
+ ```
16
+
17
+ ## ImmutableStructEx
18
+ ImmutableStructEx allows you do this in one step:
19
+
20
+ ```ruby
21
+ immutable_struct_ex = ImmutableStructEx.new(first: 'John', last: 'Doe', phone: '(201) 230-7281')
22
+ immutable_struct_ex.first
23
+ #=> 'John'
24
+ immutable_struct_ex[:first]
25
+ #=> 'John'
26
+ immutable_struct_ex.last
27
+ #=> 'Doe'
28
+ immutable_struct_ex.phone
29
+ #=> '(201) 230-7281'
30
+ ```
31
+ ### Immutable
32
+ Like other immutable structs, ImmutableStructEx also removes methods that change the state of the object:
33
+ ```ruby
34
+ immutable_struct_ex.first = 'Joe'
35
+ #=> NoMethodError: undefined method `first='...
36
+ immutable_struct_ex[:first] = 'Joe'
37
+ #=> NoMethodError: undefined method `[]='...
38
+ ```
39
+
40
+ ### Blocks
41
+ Also, not unlike other immutable structs, ImmutableStructEx also allows you to pass a block:
42
+ ```ruby
43
+ # With a block
44
+ immutable_struct_ex = ImmutableStructEx.new(first: 'John', last: 'Doe', phone: '(201) 230-7281') do
45
+ def john?
46
+ first == 'John'
47
+ end
48
+ end
49
+ immutable_struct_ex.john?
50
+ #=> true
51
+ ```
52
+
53
+ ## Installation
54
+
55
+ Add this line to your application's Gemfile:
56
+
57
+ ```ruby
58
+ gem 'immutable_struct_ex'
59
+ ```
60
+
61
+ And then execute:
62
+
63
+ $ bundle
64
+
65
+ Or install it yourself as:
66
+
67
+ $ gem install immutable_struct_ex
68
+
69
+ ## Development
70
+
71
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
72
+
73
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
74
+
75
+ ## Contributing
76
+
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/immutable_struct_ex. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
78
+
79
+ ## License
80
+
81
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
82
+
83
+ ## Code of Conduct
84
+
85
+ Everyone interacting in the ImmutableStructEx project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/immutable_struct_ex/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'immutable_struct_ex'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'immutable_struct_ex/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'immutable_struct_ex'
9
+ spec.version = ImmutableStructEx::VERSION
10
+ spec.authors = ['Gene M. Angelo, Jr.']
11
+ spec.email = ['public.gma@gmail.com']
12
+
13
+ spec.summary = 'Creates an immutable struct in one step.'
14
+ spec.description = 'Creates an immutable struct in one step.'
15
+ spec.homepage = 'https://github.com/gangelo/immutable_struct_ex'
16
+ spec.license = 'MIT'
17
+ spec.required_ruby_version = '>= 3.0.1'
18
+
19
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
20
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
21
+ # if spec.respond_to?(:metadata)
22
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
23
+ # else
24
+ # raise 'RubyGems 2.0 or newer is required to protect against ' \
25
+ # 'public gem pushes.'
26
+ # end
27
+
28
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
29
+ f.match(%r{^(test|spec|features)/})
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.add_development_dependency 'pry-byebug', '~> 3.9'
36
+ spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.4'
37
+ # This verson of rubocop is returning errors.
38
+ # spec.add_development_dependency 'rubocop', '~> 1.14'
39
+ spec.add_development_dependency 'rubocop', '~> 1.9.1'
40
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11', '>= 1.11.3'
41
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
42
+ spec.add_development_dependency 'simplecov', '~> 0.21.2'
43
+
44
+ spec.add_development_dependency 'bundler', '~> 2.3.0'
45
+ spec.add_development_dependency 'rake', '~> 10.0'
46
+ spec.add_development_dependency 'rspec', '~> 3.0'
47
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ImmutableStructEx
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'immutable_struct_ex/version'
4
+
5
+ # Defines the methods used to create/manage the ImmutableStructEx struct.
6
+ module ImmutableStructEx
7
+ class << self
8
+ def new(**hash, &block)
9
+ options_struct = Struct.new(*hash.keys, keyword_init: true, &block)
10
+ options_struct.new(**hash).tap do |struct|
11
+ [:[], *struct.members].each do |method|
12
+ struct.instance_eval { undef :"#{method}=" }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: immutable_struct_ex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gene M. Angelo, Jr.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-08-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry-byebug
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: reek
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 6.0.4
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '6.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 6.0.4
47
+ - !ruby/object:Gem::Dependency
48
+ name: rubocop
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 1.9.1
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 1.9.1
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop-performance
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.11'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.11.3
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.11'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.11.3
81
+ - !ruby/object:Gem::Dependency
82
+ name: rubocop-rspec
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '2.3'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '2.3'
95
+ - !ruby/object:Gem::Dependency
96
+ name: simplecov
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: 0.21.2
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: 0.21.2
109
+ - !ruby/object:Gem::Dependency
110
+ name: bundler
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: 2.3.0
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: 2.3.0
123
+ - !ruby/object:Gem::Dependency
124
+ name: rake
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '10.0'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '10.0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: rspec
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '3.0'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '3.0'
151
+ description: Creates an immutable struct in one step.
152
+ email:
153
+ - public.gma@gmail.com
154
+ executables: []
155
+ extensions: []
156
+ extra_rdoc_files: []
157
+ files:
158
+ - ".gitignore"
159
+ - ".reek.yml"
160
+ - ".rspec"
161
+ - ".rubocop.yml"
162
+ - ".ruby-version"
163
+ - ".travis.yml"
164
+ - CODE_OF_CONDUCT.md
165
+ - Gemfile
166
+ - Gemfile.lock
167
+ - LICENSE.txt
168
+ - README.md
169
+ - Rakefile
170
+ - bin/console
171
+ - bin/setup
172
+ - immutable_struct_ex.gemspec
173
+ - lib/immutable_struct_ex.rb
174
+ - lib/immutable_struct_ex/version.rb
175
+ homepage: https://github.com/gangelo/immutable_struct_ex
176
+ licenses:
177
+ - MIT
178
+ metadata: {}
179
+ post_install_message:
180
+ rdoc_options: []
181
+ require_paths:
182
+ - lib
183
+ required_ruby_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: 3.0.1
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubygems_version: 3.2.15
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Creates an immutable struct in one step.
198
+ test_files: []