striuct 0.9.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/instancemethods/README.md +1 -2
- data/lib/striuct/instancemethods/setter.rb +2 -1
- metadata +11 -10
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', '~> 0.
|
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,14 +1,14 @@
|
|
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
|
-
autorequire:
|
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
|
@@ -31,7 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
-
|
34
|
+
- LICENSE
|
35
35
|
- README.md
|
36
36
|
- lib/striuct.rb
|
37
37
|
- lib/striuct/bootstrap.rb
|
@@ -76,12 +76,10 @@ homepage: https://github.com/kachick/striuct
|
|
76
76
|
licenses:
|
77
77
|
- MIT
|
78
78
|
metadata:
|
79
|
-
documentation_uri: https://kachick.github.io/striuct/
|
80
|
-
homepage_uri: https://github.com/kachick/striuct
|
81
79
|
source_code_uri: https://github.com/kachick/striuct
|
82
80
|
bug_tracker_uri: https://github.com/kachick/striuct/issues
|
83
81
|
rubygems_mfa_required: 'true'
|
84
|
-
post_install_message:
|
82
|
+
post_install_message:
|
85
83
|
rdoc_options: []
|
86
84
|
require_paths:
|
87
85
|
- lib
|
@@ -89,15 +87,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
87
|
requirements:
|
90
88
|
- - ">="
|
91
89
|
- !ruby/object:Gem::Version
|
92
|
-
version: 2
|
90
|
+
version: '3.2'
|
91
|
+
- - "<"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.4'
|
93
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
95
|
requirements:
|
95
96
|
- - ">="
|
96
97
|
- !ruby/object:Gem::Version
|
97
98
|
version: '0'
|
98
99
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
100
|
-
signing_key:
|
100
|
+
rubygems_version: 3.5.7
|
101
|
+
signing_key:
|
101
102
|
specification_version: 4
|
102
103
|
summary: Struct++
|
103
104
|
test_files: []
|