lite-ruby 1.1.9 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +10 -10
- data/docs/OPEN_STRUCT.md +0 -20
- data/docs/STRUCT.md +1 -0
- data/lib/lite/ruby/open_struct.rb +10 -13
- data/lib/lite/ruby/struct.rb +1 -1
- data/lib/lite/ruby/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63d0d01fd2b88f0a9362009571181cd8d13f1c504662138d2c5b811cf1e8282c
|
4
|
+
data.tar.gz: b1f8de0ba8ab9c9516a59e949108d476527d285d0397c392cd03968f771e032c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da98aab18c440e3b346ace43c94773688930837ce9df4ada5ecab7e8512e957e63cb126103b5d7e4dceaa3d124af0983797dc352a53767b1791fa83389ed9cf4
|
7
|
+
data.tar.gz: 56a911edc10244b5316665eabb0b8b68d2c572362e28a7a3b60ca6760008875c9736f92904f70b1c0367cb503f7a6c9eb9459464273c15bfcc26364caf774221
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.1.10] - 2021-06-21
|
10
|
+
### Changed
|
11
|
+
- Struct `[]` to be accessible via `attributes`
|
12
|
+
### Removed
|
13
|
+
- OpenStruct `[]` and `[]=` existing methods
|
14
|
+
|
9
15
|
## [1.1.9] - 2021-05-26
|
10
16
|
### Added
|
11
17
|
- Added Array => `match`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-ruby (1.1.
|
4
|
+
lite-ruby (1.1.10)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
ast (2.4.2)
|
29
29
|
builder (3.2.4)
|
30
30
|
colorize (0.8.1)
|
31
|
-
concurrent-ruby (1.1.
|
31
|
+
concurrent-ruby (1.1.9)
|
32
32
|
crass (1.0.6)
|
33
33
|
diff-lcs (1.4.4)
|
34
34
|
erubi (1.10.0)
|
@@ -40,13 +40,13 @@ GEM
|
|
40
40
|
railties (>= 3.0.0)
|
41
41
|
i18n (1.8.10)
|
42
42
|
concurrent-ruby (~> 1.0)
|
43
|
-
loofah (2.
|
43
|
+
loofah (2.10.0)
|
44
44
|
crass (~> 1.0.2)
|
45
45
|
nokogiri (>= 1.5.9)
|
46
46
|
method_source (1.0.0)
|
47
|
-
mini_portile2 (2.5.
|
47
|
+
mini_portile2 (2.5.3)
|
48
48
|
minitest (5.14.4)
|
49
|
-
nokogiri (1.11.
|
49
|
+
nokogiri (1.11.7)
|
50
50
|
mini_portile2 (~> 2.5.0)
|
51
51
|
racc (~> 1.4)
|
52
52
|
parallel (1.20.1)
|
@@ -84,23 +84,23 @@ GEM
|
|
84
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
85
|
rspec-support (~> 3.10.0)
|
86
86
|
rspec-support (3.10.2)
|
87
|
-
rubocop (1.
|
87
|
+
rubocop (1.17.0)
|
88
88
|
parallel (~> 1.10)
|
89
89
|
parser (>= 3.0.0.0)
|
90
90
|
rainbow (>= 2.2.2, < 4.0)
|
91
91
|
regexp_parser (>= 1.8, < 3.0)
|
92
92
|
rexml
|
93
|
-
rubocop-ast (>= 1.
|
93
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
94
94
|
ruby-progressbar (~> 1.7)
|
95
95
|
unicode-display_width (>= 1.4.0, < 3.0)
|
96
|
-
rubocop-ast (1.
|
96
|
+
rubocop-ast (1.7.0)
|
97
97
|
parser (>= 3.0.1.1)
|
98
98
|
rubocop-performance (1.11.3)
|
99
99
|
rubocop (>= 1.7.0, < 2.0)
|
100
100
|
rubocop-ast (>= 0.4.0)
|
101
101
|
rubocop-rake (0.5.1)
|
102
102
|
rubocop
|
103
|
-
rubocop-rspec (2.
|
103
|
+
rubocop-rspec (2.4.0)
|
104
104
|
rubocop (~> 1.0)
|
105
105
|
rubocop-ast (>= 1.1.0)
|
106
106
|
ruby-progressbar (1.11.0)
|
@@ -129,4 +129,4 @@ DEPENDENCIES
|
|
129
129
|
rubocop-rspec
|
130
130
|
|
131
131
|
BUNDLED WITH
|
132
|
-
2.2.
|
132
|
+
2.2.19
|
data/docs/OPEN_STRUCT.md
CHANGED
@@ -9,26 +9,6 @@ OpenStruct.new(name: 'bob', age: 60) do |o|
|
|
9
9
|
end
|
10
10
|
```
|
11
11
|
|
12
|
-
`[]`
|
13
|
-
------
|
14
|
-
Access a value in the OpenStruct by key, like a Hash.
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
person = OpenStruct.new(name: 'bob', age: 60)
|
18
|
-
|
19
|
-
person['name'] #=> 'bob'
|
20
|
-
```
|
21
|
-
|
22
|
-
`[]=`
|
23
|
-
------
|
24
|
-
Store a value in the OpenStruct by key, like a Hash.
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
person = OpenStruct.new(name: 'bob', age: 60)
|
28
|
-
|
29
|
-
person['name'] = 'tim'
|
30
|
-
```
|
31
|
-
|
32
12
|
`attributes`
|
33
13
|
------
|
34
14
|
Returns the key values as a hash of the assigned struct.
|
data/docs/STRUCT.md
CHANGED
@@ -20,24 +20,12 @@ if Lite::Ruby.configuration.monkey_patches.include?('open_struct')
|
|
20
20
|
yield self if block && block.arity == 1
|
21
21
|
end
|
22
22
|
|
23
|
-
def [](key)
|
24
|
-
key = key.to_sym unless key.is_a?(Symbol)
|
25
|
-
@table[key]
|
26
|
-
end
|
27
|
-
|
28
|
-
def []=(key, val)
|
29
|
-
raise TypeError, "can't modify frozen #{self.class}", caller(1) if frozen?
|
30
|
-
|
31
|
-
key = key.to_sym unless key.is_a?(Symbol)
|
32
|
-
@table[key] = val
|
33
|
-
end
|
34
|
-
|
35
23
|
def attributes
|
36
24
|
@table
|
37
25
|
end
|
38
26
|
|
39
27
|
def replace(args)
|
40
|
-
args.
|
28
|
+
args.each { |key, val| send("#{key}=", val) }
|
41
29
|
end
|
42
30
|
|
43
31
|
def to_hash(table: true)
|
@@ -53,5 +41,14 @@ if Lite::Ruby.configuration.monkey_patches.include?('open_struct')
|
|
53
41
|
alias as_json to_json
|
54
42
|
alias to_h to_hash
|
55
43
|
|
44
|
+
private
|
45
|
+
|
46
|
+
def new_ostruct_member!(name)
|
47
|
+
return if is_method_protected!(name)
|
48
|
+
|
49
|
+
define_singleton_method!(name) { @table[name] }
|
50
|
+
define_singleton_method!("#{name}=") { |x| @table[name] = x }
|
51
|
+
end
|
52
|
+
|
56
53
|
end
|
57
54
|
end
|
data/lib/lite/ruby/struct.rb
CHANGED
data/lib/lite/ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
|
-
rubygems_version: 3.2.
|
225
|
+
rubygems_version: 3.2.19
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Collection of useful Ruby methods for its primitive classes
|