lite-ruby 1.1.13 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +7 -7
- data/docs/OPEN_STRUCT.md +0 -9
- data/lib/lite/ruby/open_struct.rb +0 -48
- 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: 70999d7bfc996b80f4dfc5911b3eeca10f10219e8c7eeabdcafd18a6a1013621
|
4
|
+
data.tar.gz: 3697787f3d99687ab0b47fc39308c41637956ffe9b4d4258ce1a46916b90e463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555e3a07381d386ae8a7c3acfb9aecf948d1cf7e733f9f932922ab8967bc4d0c9667728e8049553a0b9e393e25cae09a319c891ee544ffdd856f2fae3d31129c
|
7
|
+
data.tar.gz: fa78a2576aef3d4111f5cd0134b6311f3a17cea5c72c789df925d37550831e8c3ec7a42e478235823ced8c6389051148036542c47d5d9dfa3804cd9dc72def70
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.3.0] - 2021-07-19
|
10
|
+
### Added
|
11
|
+
- Added Ruby 3.0 support
|
12
|
+
|
13
|
+
## [1.2.0] - 2021-07-09
|
14
|
+
### Removed
|
15
|
+
- OpenStruct block initialization due to unreliability
|
16
|
+
|
17
|
+
## [1.1.15] - 2021-07-05
|
18
|
+
### Changed
|
19
|
+
- Added more OpenStruct backwards compatibility
|
20
|
+
|
21
|
+
## [1.1.14] - 2021-07-05
|
22
|
+
### Changed
|
23
|
+
- Fixed mistake in OpenStruct backwards compatibility
|
24
|
+
|
9
25
|
## [1.1.13] - 2021-07-05
|
10
26
|
### Added
|
11
27
|
- Added more OpenStruct backwards compatibility
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-ruby (1.
|
4
|
+
lite-ruby (1.3.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
mini_portile2 (~> 2.5.0)
|
51
51
|
racc (~> 1.4)
|
52
52
|
parallel (1.20.1)
|
53
|
-
parser (3.0.
|
53
|
+
parser (3.0.2.0)
|
54
54
|
ast (~> 2.4.1)
|
55
55
|
racc (1.5.2)
|
56
56
|
rack (2.2.3)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
rake (>= 0.13)
|
69
69
|
thor (~> 1.0)
|
70
70
|
rainbow (3.0.0)
|
71
|
-
rake (13.0.
|
71
|
+
rake (13.0.6)
|
72
72
|
regexp_parser (2.1.1)
|
73
73
|
rexml (3.2.5)
|
74
74
|
rspec (3.10.0)
|
@@ -84,7 +84,7 @@ 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.18.
|
87
|
+
rubocop (1.18.3)
|
88
88
|
parallel (~> 1.10)
|
89
89
|
parser (>= 3.0.0.0)
|
90
90
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -93,9 +93,9 @@ GEM
|
|
93
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.8.0)
|
97
97
|
parser (>= 3.0.1.1)
|
98
|
-
rubocop-performance (1.11.
|
98
|
+
rubocop-performance (1.11.4)
|
99
99
|
rubocop (>= 1.7.0, < 2.0)
|
100
100
|
rubocop-ast (>= 0.4.0)
|
101
101
|
rubocop-rake (0.6.0)
|
@@ -129,4 +129,4 @@ DEPENDENCIES
|
|
129
129
|
rubocop-rspec
|
130
130
|
|
131
131
|
BUNDLED WITH
|
132
|
-
2.2.
|
132
|
+
2.2.24
|
data/docs/OPEN_STRUCT.md
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
# OpenStruct
|
2
2
|
|
3
|
-
`Initialize`
|
4
|
-
Allows the initialization of an OpenStruct with a setter block.
|
5
|
-
|
6
|
-
```ruby
|
7
|
-
OpenStruct.new(name: 'bob', age: 60) do |o|
|
8
|
-
o.gender = :M
|
9
|
-
end
|
10
|
-
```
|
11
|
-
|
12
3
|
`attributes`
|
13
4
|
------
|
14
5
|
Returns the key values as a hash of the assigned struct.
|
@@ -5,21 +5,6 @@ if Lite::Ruby.configuration.monkey_patches.include?('open_struct')
|
|
5
5
|
|
6
6
|
class OpenStruct
|
7
7
|
|
8
|
-
def initialize(hash = nil, &block)
|
9
|
-
@table = if block && block.arity == 2
|
10
|
-
Hash.new(&block)
|
11
|
-
else
|
12
|
-
{}
|
13
|
-
end
|
14
|
-
|
15
|
-
hash&.each do |key, val|
|
16
|
-
@table[key.to_sym] = val
|
17
|
-
new_ostruct_member!(key)
|
18
|
-
end
|
19
|
-
|
20
|
-
yield self if block && block.arity == 1
|
21
|
-
end
|
22
|
-
|
23
8
|
def attributes
|
24
9
|
@table
|
25
10
|
end
|
@@ -41,38 +26,5 @@ if Lite::Ruby.configuration.monkey_patches.include?('open_struct')
|
|
41
26
|
alias as_json to_json
|
42
27
|
alias to_h to_hash
|
43
28
|
|
44
|
-
private
|
45
|
-
|
46
|
-
# rubocop:disable Metrics/MethodLength, Naming/PredicateName
|
47
|
-
def is_method_protected!(name)
|
48
|
-
return false unless respond_to?(name, true)
|
49
|
-
return true if name.match?(/!$/)
|
50
|
-
|
51
|
-
owner = method!(name).owner
|
52
|
-
|
53
|
-
if owner.instance_of?(::Class)
|
54
|
-
owner < ::OpenStruct
|
55
|
-
else
|
56
|
-
self.class.ancestors.any? do |mod|
|
57
|
-
return false if mod == ::OpenStruct
|
58
|
-
|
59
|
-
mod == owner
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
# rubocop:enable Metrics/MethodLength, Naming/PredicateName
|
64
|
-
|
65
|
-
def new_ostruct_member!(name)
|
66
|
-
return if is_method_protected!(name)
|
67
|
-
|
68
|
-
if respond_to?(:define_singleton_method!)
|
69
|
-
define_singleton_method(name) { @table[name] }
|
70
|
-
define_singleton_method("#{name}=") { |x| @table[name] = x }
|
71
|
-
else
|
72
|
-
define_singleton_method!(name) { @table[name] }
|
73
|
-
define_singleton_method!("#{name}=") { |x| @table[name] = x }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
29
|
end
|
78
30
|
end
|
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.
|
4
|
+
version: 1.3.0
|
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-07-
|
11
|
+
date: 2021-07-20 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.24
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Collection of useful Ruby methods for its primitive classes
|