value_struct 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +29 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/ChangeLog.md +11 -1
- data/README.md +5 -5
- data/Rakefile +0 -2
- data/gemspec.yml +2 -3
- data/lib/value_struct/version.rb +3 -1
- metadata +8 -21
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cf453d5f0facd3eb8b193f9a4a525c401704028f9a6b54be2ed111ddb75554b5
|
4
|
+
data.tar.gz: b79eadaa63a8bd2eba9502a5bce1e05d35f22ea764c67e9b0fb3bcc7a58d5d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de120c16fbb101bf8477c7994d45d8a06f9f635969459b0028252d80e42248bf0d964c3de68e1f38df40df5b93f125be36af5b1e0d0c9d50f7fae6d9c29efc80
|
7
|
+
data.tar.gz: a6041b137b960d81e0d7abccaa3d74aa272f7664844e9decdc0701441b9019829eeeea974b86e050df92e84eb9cf5969b1ef29be2c2173cd34c4a655c47daa80
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: Ruby ${{ matrix.ruby }} (${{ matrix.os }})
|
8
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby:
|
12
|
+
- 3.0
|
13
|
+
- 2.7
|
14
|
+
- 2.6
|
15
|
+
- 2.5
|
16
|
+
- jruby-9.2.13.0
|
17
|
+
# - truffleruby-20.3.0
|
18
|
+
os:
|
19
|
+
- ubuntu-latest
|
20
|
+
runs-on: ${{matrix.os}}
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{matrix.ruby}}
|
27
|
+
bundler-cache: true
|
28
|
+
- name: Run tests
|
29
|
+
run: bundle exec rake
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 conduct@janlelis.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/ChangeLog.md
CHANGED
@@ -1,15 +1,25 @@
|
|
1
|
+
## Change Log
|
2
|
+
|
3
|
+
### 0.8.1
|
4
|
+
|
5
|
+
* Relax Ruby version requirement to allow Ruby 3.0
|
6
|
+
|
1
7
|
### 0.8.0
|
8
|
+
|
2
9
|
* Drop support for Ruby 1
|
3
10
|
* Remove #to_h mixin
|
4
11
|
|
5
12
|
### 0.7.0
|
13
|
+
|
6
14
|
* Improve mixin system
|
7
15
|
* More logical class/model/inheritance logic
|
8
16
|
* Rename Clone mixin to NoClone
|
9
17
|
|
10
18
|
### 0.6.0
|
19
|
+
|
11
20
|
* Fix specs
|
12
21
|
* Fix #dup
|
13
22
|
|
14
23
|
### 0.5.0
|
15
|
-
|
24
|
+
|
25
|
+
* Initial public release
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# Value Struct [![[
|
1
|
+
# Value Struct [![[version]](https://badge.fury.io/rb/value_struct.svg)](https://badge.fury.io/rb/value_struct) [![[ci]](https://github.com/janlelis/value_struct/workflows/Test/badge.svg)](https://github.com/janlelis/value_struct/actions?query=workflow%3ATest)
|
2
2
|
|
3
|
-
A value struct is a subclass of the normal [Ruby struct](http://
|
3
|
+
A value struct is a subclass of the normal [Ruby struct](http://graysoftinc.com/ruby-voodoo/all-about-struct) that behaves almost the same. However, it has a major difference:
|
4
4
|
|
5
5
|
__Value structs are immutable, i.e. they don't have setters (although, not recursively*)__
|
6
6
|
|
@@ -17,7 +17,7 @@ Without mixins, ValueStructs are almost as fast as normal structs. Some mixins a
|
|
17
17
|
|
18
18
|
## Why?
|
19
19
|
|
20
|
-
See [this blog article](
|
20
|
+
See [this blog article](https://rbjl.janlelis.com/65-value_struct-read-only-structs-in-ruby) for more information.
|
21
21
|
|
22
22
|
## Example 1
|
23
23
|
|
@@ -26,7 +26,7 @@ See [this blog article](http://ruby.janlelis.de/65-value_struct-read-only-struct
|
|
26
26
|
SimplePoint = ValueStruct.new(:x, :y)
|
27
27
|
|
28
28
|
|
29
|
-
Please refer to the [documentation of Ruby's struct](
|
29
|
+
Please refer to the [documentation of Ruby's struct](https://ruby-doc.org/core/Struct.html) for more details on general struct usage.
|
30
30
|
|
31
31
|
## How to use structs with mixins
|
32
32
|
|
@@ -54,7 +54,7 @@ Alternatively, you can put custom modules in the mixin array.
|
|
54
54
|
) do
|
55
55
|
|
56
56
|
def initialize(x,y)
|
57
|
-
raise ArgumentError, 'points must be
|
57
|
+
raise ArgumentError, 'points must be initialized with two numerics' unless x.is_a?(Numeric) && y.is_a?(Numeric)
|
58
58
|
super(x,y)
|
59
59
|
end
|
60
60
|
|
data/Rakefile
CHANGED
data/gemspec.yml
CHANGED
@@ -2,13 +2,12 @@ name: value_struct
|
|
2
2
|
summary: "Struct-like value objects"
|
3
3
|
license: MIT
|
4
4
|
authors: Jan Lelis
|
5
|
-
email:
|
5
|
+
email: hi@ruby.consulting
|
6
6
|
homepage: https://github.com/janlelis/value_struct
|
7
7
|
|
8
|
-
required_ruby_version:
|
8
|
+
required_ruby_version: ">= 2.0"
|
9
9
|
|
10
10
|
development_dependencies:
|
11
|
-
bundler: ~> 1.0
|
12
11
|
rake: ~> 0.8
|
13
12
|
rspec: ~> 2.4
|
14
13
|
rubygems-tasks: ~> 0.2
|
data/lib/value_struct/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: value_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,20 +109,22 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 1.1.1
|
125
111
|
description: ''
|
126
|
-
email:
|
112
|
+
email: hi@ruby.consulting
|
127
113
|
executables: []
|
128
114
|
extensions: []
|
129
115
|
extra_rdoc_files:
|
116
|
+
- CODE_OF_CONDUCT.md
|
130
117
|
- ChangeLog.md
|
131
118
|
- MIT-LICENSE.txt
|
132
119
|
- README.md
|
133
120
|
files:
|
134
121
|
- ".document"
|
135
122
|
- ".editorconfig"
|
123
|
+
- ".github/workflows/test.yml"
|
136
124
|
- ".gitignore"
|
137
125
|
- ".rspec"
|
138
|
-
- ".travis.yml"
|
139
126
|
- ".yardopts"
|
127
|
+
- CODE_OF_CONDUCT.md
|
140
128
|
- ChangeLog.md
|
141
129
|
- Gemfile
|
142
130
|
- MIT-LICENSE.txt
|
@@ -168,7 +156,7 @@ require_paths:
|
|
168
156
|
- lib
|
169
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
170
158
|
requirements:
|
171
|
-
- - "
|
159
|
+
- - ">="
|
172
160
|
- !ruby/object:Gem::Version
|
173
161
|
version: '2.0'
|
174
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -177,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
165
|
- !ruby/object:Gem::Version
|
178
166
|
version: '0'
|
179
167
|
requirements: []
|
180
|
-
|
181
|
-
rubygems_version: 2.4.5
|
168
|
+
rubygems_version: 3.2.4
|
182
169
|
signing_key:
|
183
170
|
specification_version: 4
|
184
171
|
summary: Struct-like value objects
|