striuct 0.8.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{MIT-LICENSE.txt → LICENSE} +0 -2
- data/README.md +21 -22
- data/lib/striuct/classmethods/README.md +3 -5
- data/lib/striuct/classmethods/adjustment.rb +1 -1
- data/lib/striuct/classmethods/attributes.rb +1 -1
- data/lib/striuct/instancemethods/README.md +1 -2
- data/lib/striuct/instancemethods/setter.rb +2 -1
- metadata +13 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 209dd1ff84de379965762e6b1dfc8d730487125aac3c68601198212a45b73491
|
4
|
+
data.tar.gz: cd659be7ccc4e033c01805189ea00242ccb298c002d7ced0190dcfa69793639f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c84b2a3fd370f35315b809b748a1b5fd45682e45ca7edff772806d40dc910535862c2f4464b81aacb87d0af8472c06e2ea9d0139dce76ce98acab2b209a1b97
|
7
|
+
data.tar.gz: abc84b95eac37052258aecaed387c9e8adb9e7c8ab8c8aa9463c7e910681f32690044fdf9bd8b9e70925b8a49c5b111bbe3ce1182eac03b705f5061715b027f0
|
data/{MIT-LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
# striuct
|
2
2
|
|
3
3
|
![Build Status](https://github.com/kachick/striuct/actions/workflows/test_behaviors.yml/badge.svg?branch=main)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/striuct.
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/striuct.svg)](http://badge.fury.io/rb/striuct)
|
5
5
|
|
6
6
|
Struct++
|
7
7
|
|
8
|
+
- _**This repository is archived**_
|
9
|
+
- _**No longer maintained**_
|
10
|
+
- _**I didn't remove old versions on https://rubygems.org/gems/striuct, but I no longer plan to update them.**_
|
11
|
+
|
8
12
|
## Usage
|
9
13
|
|
10
|
-
|
14
|
+
Tested in Ruby 3.2 or 3.3
|
11
15
|
|
12
16
|
Add this line to your `Gemfile`
|
13
17
|
|
14
18
|
```ruby
|
15
|
-
gem 'striuct', '
|
19
|
+
gem 'striuct', '~> 0.10.1'
|
16
20
|
```
|
17
21
|
|
18
22
|
Then add below code into your Ruby code
|
@@ -96,28 +100,23 @@ UseMustOption.new #=> InvalidOperationError "`foo` require a value under `must`
|
|
96
100
|
|
97
101
|
### Strict
|
98
102
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
103
|
+
- Easy and Flexible Validations
|
104
|
+
- Basically use `#===` for the validation
|
105
|
+
- The pattern builder DSL is just using [eqq](https://github.com/kachick/eqq)
|
106
|
+
- When passed the Proc, it will be evaluated in the instance context
|
107
|
+
- Prevent to conflict member names
|
108
|
+
- Lock setters for each member
|
105
109
|
|
106
110
|
### Useful
|
107
111
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
- Hook just before setters
|
113
|
+
- Default value
|
114
|
+
- Member aliasing
|
115
|
+
- Inheritable
|
116
|
+
- Handling between nil <-> unassigned
|
117
|
+
- Similar API for Hash
|
114
118
|
|
115
119
|
### Finally
|
116
120
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
## Link
|
121
|
-
|
122
|
-
* [Repository](https://github.com/kachick/striuct)
|
123
|
-
* [API documents](https://kachick.github.io/striuct/)
|
121
|
+
- Base API looks like Struct
|
122
|
+
- Pure Ruby :)
|
@@ -42,7 +42,8 @@ class Striuct
|
|
42
42
|
|
43
43
|
@db[autonym] = value
|
44
44
|
rescue InvalidValueError
|
45
|
-
|
45
|
+
# @note Why caller with range instead of the index? See https://github.com/rubocop/rubocop/pull/4078
|
46
|
+
unless caller(2..2).first.slice(/([^:]+)\z/).include?('in []=')
|
46
47
|
$!.backtrace.delete_if { |s| /#{Regexp.escape(File.dirname(__FILE__))}/ =~ s }
|
47
48
|
$!.backtrace.first.sub!(/([^:]+)\z/) { "in `#{autonym}='" }
|
48
49
|
end
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: striuct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi Kamiya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eqq
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.1.0
|
19
|
+
version: 0.1.1
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.0.5
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.1.
|
26
|
+
version: 0.1.1
|
33
27
|
description: " Struct + validation + inheritable + default_value + etc...\n"
|
34
28
|
email:
|
35
29
|
- kachick1+ruby@gmail.com
|
@@ -37,7 +31,7 @@ executables: []
|
|
37
31
|
extensions: []
|
38
32
|
extra_rdoc_files: []
|
39
33
|
files:
|
40
|
-
-
|
34
|
+
- LICENSE
|
41
35
|
- README.md
|
42
36
|
- lib/striuct.rb
|
43
37
|
- lib/striuct/bootstrap.rb
|
@@ -82,10 +76,9 @@ homepage: https://github.com/kachick/striuct
|
|
82
76
|
licenses:
|
83
77
|
- MIT
|
84
78
|
metadata:
|
85
|
-
documentation_uri: https://kachick.github.io/striuct/
|
86
|
-
homepage_uri: https://github.com/kachick/striuct
|
87
79
|
source_code_uri: https://github.com/kachick/striuct
|
88
80
|
bug_tracker_uri: https://github.com/kachick/striuct/issues
|
81
|
+
rubygems_mfa_required: 'true'
|
89
82
|
post_install_message:
|
90
83
|
rdoc_options: []
|
91
84
|
require_paths:
|
@@ -94,14 +87,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
87
|
requirements:
|
95
88
|
- - ">="
|
96
89
|
- !ruby/object:Gem::Version
|
97
|
-
version: 2
|
90
|
+
version: '3.2'
|
91
|
+
- - "<"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.4'
|
98
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
95
|
requirements:
|
100
96
|
- - ">="
|
101
97
|
- !ruby/object:Gem::Version
|
102
98
|
version: '0'
|
103
99
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.5.7
|
105
101
|
signing_key:
|
106
102
|
specification_version: 4
|
107
103
|
summary: Struct++
|