smart_engine 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +14 -1
- data/Gemfile.lock +56 -59
- data/LICENSE.txt +1 -1
- data/README.md +93 -2
- data/lib/smart_core/engine/cache.rb +49 -0
- data/lib/smart_core/engine/frozener.rb +6 -0
- data/lib/smart_core/engine/version.rb +2 -2
- data/lib/smart_core/engine.rb +1 -0
- data/lib/smart_core/errors.rb +3 -2
- data/lib/smart_core/ext/basic_object_as_object.rb +30 -0
- data/smart_engine.gemspec +5 -5
- metadata +13 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48de1362f022e1e37a6a234db4936b0077c9d5cc818ac2bb73a72157f4b949dc
|
|
4
|
+
data.tar.gz: cf4e6d5a6c51d926fc6d5186d0857006d7a114811be4d4f753283e1872575cdf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dda02f4e36e5c85f3a1117ba85013ab99120956166501c31e0178f6f58898a8a9fb87a585d80a1d9174d5f0eca72139e954bb73a1b0ea72dd7d79a36a41636e8
|
|
7
|
+
data.tar.gz: 905bb7bea34f0d101633dd64e0709f50671d81eaa8ed0b7d5880892f760e62a038605173936ea9d27f8e51680d11495f5b1de0cfefd57490450a67f7ebc3ec69
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [Unreleased]
|
|
5
|
+
### Added
|
|
6
|
+
- Simplest in-memory cache storage implementation: `SmartCore::Engine::Cache`;
|
|
7
|
+
### Changed
|
|
8
|
+
- Minimal Ruby version is `2.5` (`>= 2.5`);
|
|
9
|
+
- Better `BasicObject`'s refinement extention specs;
|
|
10
|
+
- Updated development dependencies;
|
|
11
|
+
|
|
12
|
+
## [0.12.0] - 2021-12-09
|
|
13
|
+
### Added
|
|
14
|
+
- `using SmartCore::Ext::BasicObjectAsObject` provides native support for:
|
|
15
|
+
- `BasicObject#inspect`;
|
|
16
|
+
|
|
4
17
|
## [0.11.0] - 2021-01-17
|
|
5
18
|
### Added
|
|
6
|
-
- Support for
|
|
19
|
+
- Support for **Ruby@3**;
|
|
7
20
|
|
|
8
21
|
## [0.10.0] - 2020-12-22
|
|
9
22
|
### Added
|
data/Gemfile.lock
CHANGED
|
@@ -1,102 +1,99 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
smart_engine (0.
|
|
4
|
+
smart_engine (0.13.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
activesupport (
|
|
9
|
+
activesupport (7.0.4)
|
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
11
11
|
i18n (>= 1.6, < 2)
|
|
12
12
|
minitest (>= 5.1)
|
|
13
13
|
tzinfo (~> 2.0)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
rubocop (= 1.
|
|
17
|
-
rubocop-
|
|
18
|
-
rubocop-
|
|
19
|
-
rubocop-
|
|
20
|
-
|
|
21
|
-
ast (2.4.1)
|
|
14
|
+
armitage-rubocop (1.30.1.1)
|
|
15
|
+
rubocop (= 1.30.1)
|
|
16
|
+
rubocop-performance (= 1.14.2)
|
|
17
|
+
rubocop-rails (= 2.15.0)
|
|
18
|
+
rubocop-rake (= 0.6.0)
|
|
19
|
+
rubocop-rspec (= 2.11.1)
|
|
20
|
+
ast (2.4.2)
|
|
22
21
|
coderay (1.1.3)
|
|
23
|
-
concurrent-ruby (1.1.
|
|
24
|
-
diff-lcs (1.
|
|
25
|
-
docile (1.
|
|
26
|
-
i18n (1.
|
|
22
|
+
concurrent-ruby (1.1.10)
|
|
23
|
+
diff-lcs (1.5.0)
|
|
24
|
+
docile (1.4.0)
|
|
25
|
+
i18n (1.12.0)
|
|
27
26
|
concurrent-ruby (~> 1.0)
|
|
28
27
|
method_source (1.0.0)
|
|
29
|
-
minitest (5.
|
|
30
|
-
parallel (1.
|
|
31
|
-
parser (3.
|
|
28
|
+
minitest (5.16.3)
|
|
29
|
+
parallel (1.22.1)
|
|
30
|
+
parser (3.1.2.1)
|
|
32
31
|
ast (~> 2.4.1)
|
|
33
|
-
pry (0.
|
|
32
|
+
pry (0.14.1)
|
|
34
33
|
coderay (~> 1.1)
|
|
35
34
|
method_source (~> 1.0)
|
|
36
|
-
rack (
|
|
37
|
-
rainbow (3.
|
|
38
|
-
rake (13.0.
|
|
39
|
-
regexp_parser (2.0
|
|
40
|
-
rexml (3.2.
|
|
41
|
-
rspec (3.
|
|
42
|
-
rspec-core (~> 3.
|
|
43
|
-
rspec-expectations (~> 3.
|
|
44
|
-
rspec-mocks (~> 3.
|
|
45
|
-
rspec-core (3.
|
|
46
|
-
rspec-support (~> 3.
|
|
47
|
-
rspec-expectations (3.
|
|
35
|
+
rack (3.0.0)
|
|
36
|
+
rainbow (3.1.1)
|
|
37
|
+
rake (13.0.6)
|
|
38
|
+
regexp_parser (2.6.0)
|
|
39
|
+
rexml (3.2.5)
|
|
40
|
+
rspec (3.11.0)
|
|
41
|
+
rspec-core (~> 3.11.0)
|
|
42
|
+
rspec-expectations (~> 3.11.0)
|
|
43
|
+
rspec-mocks (~> 3.11.0)
|
|
44
|
+
rspec-core (3.11.0)
|
|
45
|
+
rspec-support (~> 3.11.0)
|
|
46
|
+
rspec-expectations (3.11.1)
|
|
48
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
49
|
-
rspec-support (~> 3.
|
|
50
|
-
rspec-mocks (3.
|
|
48
|
+
rspec-support (~> 3.11.0)
|
|
49
|
+
rspec-mocks (3.11.1)
|
|
51
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
52
|
-
rspec-support (~> 3.
|
|
53
|
-
rspec-support (3.
|
|
54
|
-
rubocop (1.
|
|
51
|
+
rspec-support (~> 3.11.0)
|
|
52
|
+
rspec-support (3.11.1)
|
|
53
|
+
rubocop (1.30.1)
|
|
55
54
|
parallel (~> 1.10)
|
|
56
|
-
parser (>=
|
|
55
|
+
parser (>= 3.1.0.0)
|
|
57
56
|
rainbow (>= 2.2.2, < 4.0)
|
|
58
57
|
regexp_parser (>= 1.8, < 3.0)
|
|
59
|
-
rexml
|
|
60
|
-
rubocop-ast (>= 1.
|
|
58
|
+
rexml (>= 3.2.5, < 4.0)
|
|
59
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
|
61
60
|
ruby-progressbar (~> 1.7)
|
|
62
|
-
unicode-display_width (>= 1.4.0, <
|
|
63
|
-
rubocop-ast (1.
|
|
64
|
-
parser (>=
|
|
65
|
-
rubocop-performance (1.
|
|
66
|
-
rubocop (>=
|
|
61
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
62
|
+
rubocop-ast (1.21.0)
|
|
63
|
+
parser (>= 3.1.1.0)
|
|
64
|
+
rubocop-performance (1.14.2)
|
|
65
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
67
66
|
rubocop-ast (>= 0.4.0)
|
|
68
|
-
rubocop-rails (2.
|
|
67
|
+
rubocop-rails (2.15.0)
|
|
69
68
|
activesupport (>= 4.2.0)
|
|
70
69
|
rack (>= 1.1)
|
|
71
|
-
rubocop (>=
|
|
72
|
-
rubocop-rake (0.
|
|
73
|
-
rubocop
|
|
74
|
-
rubocop-rspec (2.1.0)
|
|
70
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
71
|
+
rubocop-rake (0.6.0)
|
|
75
72
|
rubocop (~> 1.0)
|
|
76
|
-
|
|
73
|
+
rubocop-rspec (2.11.1)
|
|
74
|
+
rubocop (~> 1.19)
|
|
77
75
|
ruby-progressbar (1.11.0)
|
|
78
76
|
simplecov (0.21.2)
|
|
79
77
|
docile (~> 1.1)
|
|
80
78
|
simplecov-html (~> 0.11)
|
|
81
79
|
simplecov_json_formatter (~> 0.1)
|
|
82
80
|
simplecov-html (0.12.3)
|
|
83
|
-
simplecov_json_formatter (0.1.
|
|
84
|
-
tzinfo (2.0.
|
|
81
|
+
simplecov_json_formatter (0.1.4)
|
|
82
|
+
tzinfo (2.0.5)
|
|
85
83
|
concurrent-ruby (~> 1.0)
|
|
86
|
-
unicode-display_width (
|
|
87
|
-
zeitwerk (2.4.2)
|
|
84
|
+
unicode-display_width (2.3.0)
|
|
88
85
|
|
|
89
86
|
PLATFORMS
|
|
90
|
-
|
|
87
|
+
arm64-darwin-21
|
|
91
88
|
|
|
92
89
|
DEPENDENCIES
|
|
93
|
-
armitage-rubocop (~> 1.
|
|
94
|
-
bundler (~> 2.
|
|
95
|
-
pry (~> 0.
|
|
90
|
+
armitage-rubocop (~> 1.30)
|
|
91
|
+
bundler (~> 2.3)
|
|
92
|
+
pry (~> 0.14)
|
|
96
93
|
rake (~> 13.0)
|
|
97
|
-
rspec (~> 3.
|
|
94
|
+
rspec (~> 3.11)
|
|
98
95
|
simplecov (~> 0.21)
|
|
99
96
|
smart_engine!
|
|
100
97
|
|
|
101
98
|
BUNDLED WITH
|
|
102
|
-
2.
|
|
99
|
+
2.3.17
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
# SmartCore::Engine ·
|
|
1
|
+
# SmartCore::Engine · <a target="_blank" href="https://github.com/Cado-Labs"><img src="https://github.com/Cado-Labs/cado-labs-logos/raw/main/cado_labs_badge.svg" alt="Supported by Cado Labs" style="max-width: 100%; height: 20px"></a> · [](https://badge.fury.io/rb/smart_engine)
|
|
2
2
|
|
|
3
3
|
Generic SmartCore functionality.
|
|
4
4
|
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://github.com/Cado-Labs">
|
|
9
|
+
<img src="https://github.com/Cado-Labs/cado-labs-logos/blob/main/cado_labs_supporting.svg" alt="Supported by Cado Labs" />
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
5
15
|
## Installation
|
|
6
16
|
|
|
7
17
|
```ruby
|
|
@@ -24,11 +34,12 @@ require 'smart_core'
|
|
|
24
34
|
|
|
25
35
|
- [Global set of error types](#global-set-of-error-types)
|
|
26
36
|
- [Simple reentrant lock](#simple-reentrant-lock)
|
|
37
|
+
- [Cache Storage](#cache-storage)
|
|
27
38
|
- [Atomic thread-safe value container](#atomic-thread-safe-value-container)
|
|
28
39
|
- [Any Object Frozener](#any-object-frozener) (classic c-level `frozen?`/`freeze`)
|
|
29
40
|
- [Basic Object Refinements](#basic-object-refinements) (`SmartCore::Ext::BasicObjectAsObject`)
|
|
30
41
|
- [Inline rescue pipe](#inline-rescue-pipe)
|
|
31
|
-
|
|
42
|
+
|
|
32
43
|
|
|
33
44
|
---
|
|
34
45
|
|
|
@@ -51,6 +62,62 @@ lock.synchronize { your_code }
|
|
|
51
62
|
|
|
52
63
|
---
|
|
53
64
|
|
|
65
|
+
### Cache Storage
|
|
66
|
+
|
|
67
|
+
- you can use any object as a cache key;
|
|
68
|
+
- you can store any object as a cache value;
|
|
69
|
+
- you can cache `nil` object too;
|
|
70
|
+
|
|
71
|
+
- cache `read` has `fetch` semantics:
|
|
72
|
+
- signature: `#read(key, &fallback)`;
|
|
73
|
+
- in the event of cache miss the `&fallback` black will be invoked;
|
|
74
|
+
- the return value of the fallback block will be written to the cache, and that return value will be returned;
|
|
75
|
+
- cache `write`:
|
|
76
|
+
- signature: `#write(key, value)`;
|
|
77
|
+
- you can use any object as a cache key;
|
|
78
|
+
- you can store any object as a value;
|
|
79
|
+
- you can write `nil` object too;
|
|
80
|
+
- cache clear:
|
|
81
|
+
- signature: `#clear`;
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
cache = SmartCore::Engine::Cache.new
|
|
85
|
+
|
|
86
|
+
# write and read
|
|
87
|
+
cache.write(:amount, 123.456) # => 123.456
|
|
88
|
+
cache.read(:amount) # => 123.456
|
|
89
|
+
|
|
90
|
+
# read non-existing with a fallback
|
|
91
|
+
cache.read('name') # => nil
|
|
92
|
+
cache.read('name') { 'D@iVeR' } # => 'D@iVeR'
|
|
93
|
+
cache.read('name') # => 'D@iVeR'
|
|
94
|
+
|
|
95
|
+
# store nil object
|
|
96
|
+
cache.write(:nil_value, nil) # => nil
|
|
97
|
+
cache.read(:nil_value) # => nil
|
|
98
|
+
cache.read(:nil_value) { 'rewritten' } # => nil
|
|
99
|
+
cache.read(:nil_value) # => nil
|
|
100
|
+
|
|
101
|
+
# clear cache
|
|
102
|
+
cache.clear # => nil
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
# aliases:
|
|
107
|
+
|
|
108
|
+
# write:
|
|
109
|
+
cache[:key1] = 'test'
|
|
110
|
+
|
|
111
|
+
# read:
|
|
112
|
+
cache[:key1] # => 'test'
|
|
113
|
+
|
|
114
|
+
# read with fallback:
|
|
115
|
+
cache[:key2] { 'test2' } # => 'test2'
|
|
116
|
+
cache[:key2] # => 'test2'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
54
121
|
### Atomic thread-safe value container
|
|
55
122
|
|
|
56
123
|
```ruby
|
|
@@ -107,6 +174,7 @@ Ruby's `BasicObject` class does not have some fundamental (extremely important f
|
|
|
107
174
|
- `freeze` / `frozen?`
|
|
108
175
|
- `hash`
|
|
109
176
|
- `nil?`
|
|
177
|
+
- `inspect`
|
|
110
178
|
|
|
111
179
|
`SmartCore::Ext::BasicObjectAsObject` refinement solves this problem (by Ruby's internal API without any manualy-emulated behavior).
|
|
112
180
|
|
|
@@ -119,6 +187,9 @@ basic_obj.kind_of?(::BasicObject) # raises ::NoMethodError
|
|
|
119
187
|
basic_obj.instance_of?(::BasicObject) # rasies ::NoMethodError
|
|
120
188
|
basic_obj.freeze # raises ::NoMethodError
|
|
121
189
|
basic_obj.frozen? # raises ::NoMethodError
|
|
190
|
+
basic_object.hash # raises ::NoMethodError
|
|
191
|
+
basic_object.nil? # raises ::NoMethodError
|
|
192
|
+
basic_object.inspect # raises ::NoMethodError
|
|
122
193
|
```
|
|
123
194
|
|
|
124
195
|
```ruby
|
|
@@ -137,6 +208,12 @@ basic_obj.kind_of?(::Integer) # => false
|
|
|
137
208
|
basic_obj.frozen? # => false
|
|
138
209
|
basic_obj.freeze # => self
|
|
139
210
|
basic_obj.frozen? # => true
|
|
211
|
+
|
|
212
|
+
basic_obj.nil? # => false
|
|
213
|
+
|
|
214
|
+
basic_obj.hash # => 2682859680348634421 (some Integer value)
|
|
215
|
+
|
|
216
|
+
basic_obj.inspect # => "#<BasicObject:0x00007fe428018628>"
|
|
140
217
|
```
|
|
141
218
|
|
|
142
219
|
---
|
|
@@ -189,7 +266,15 @@ end
|
|
|
189
266
|
|
|
190
267
|
## Roadmap
|
|
191
268
|
|
|
269
|
+
- migrate to Github Actions in CI;
|
|
192
270
|
- thread-safety for BasicObject extensions;
|
|
271
|
+
- `SmartCore::Engine::Cache`:
|
|
272
|
+
- thread-safety;
|
|
273
|
+
- support for `ttl:` option for `#write` and for fallback block attribute of `#read`;
|
|
274
|
+
- support for key-value-pair iteration;
|
|
275
|
+
- support for `#keys` method;
|
|
276
|
+
- support for `#key?` method;
|
|
277
|
+
- think about some layer of cache object serialization;
|
|
193
278
|
|
|
194
279
|
---
|
|
195
280
|
|
|
@@ -205,6 +290,12 @@ end
|
|
|
205
290
|
|
|
206
291
|
Released under MIT License.
|
|
207
292
|
|
|
293
|
+
## Supporting
|
|
294
|
+
|
|
295
|
+
<a href="https://github.com/Cado-Labs">
|
|
296
|
+
<img src="https://github.com/Cado-Labs/cado-labs-logos/blob/main/cado_labs_logo.png" alt="Supported by Cado Labs" />
|
|
297
|
+
</a>
|
|
298
|
+
|
|
208
299
|
## Authors
|
|
209
300
|
|
|
210
301
|
[Rustam Ibragimov](https://github.com/0exp)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# @api public
|
|
4
|
+
# @since 0.13.0
|
|
5
|
+
class SmartCore::Engine::Cache
|
|
6
|
+
# @return [void]
|
|
7
|
+
#
|
|
8
|
+
# @api public
|
|
9
|
+
# @since 0.13.0
|
|
10
|
+
def initialize
|
|
11
|
+
@store = {}
|
|
12
|
+
# TODO: thread-safety (use SmartCore::Engine::Lock)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param key [Any]
|
|
16
|
+
# @apram value [Any]
|
|
17
|
+
# @return [Any]
|
|
18
|
+
#
|
|
19
|
+
# @api public
|
|
20
|
+
# @since 0.13.0
|
|
21
|
+
def write(key, value)
|
|
22
|
+
@store[key] = value
|
|
23
|
+
end
|
|
24
|
+
alias_method :[]=, :write
|
|
25
|
+
|
|
26
|
+
# @param key [Any]
|
|
27
|
+
# @param fallback [Block]
|
|
28
|
+
# @return [Any, NilClass]
|
|
29
|
+
#
|
|
30
|
+
# @api public
|
|
31
|
+
# @since 0.13.0
|
|
32
|
+
# rubocop:disable Style/NestedTernaryOperator
|
|
33
|
+
def read(key, &fallback)
|
|
34
|
+
# @note
|
|
35
|
+
# key?-flow is a compromise used to provide an ability to cache `nil` objects too.
|
|
36
|
+
@store.key?(key) ? @store[key] : (block_given? ? write(key, yield) : nil)
|
|
37
|
+
end
|
|
38
|
+
alias_method :[], :read
|
|
39
|
+
# rubocop:enable Style/NestedTernaryOperator
|
|
40
|
+
|
|
41
|
+
# @return [NilClass]
|
|
42
|
+
#
|
|
43
|
+
# @api public
|
|
44
|
+
# @since 0.13.0
|
|
45
|
+
def clear
|
|
46
|
+
@store.clear
|
|
47
|
+
nil
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -44,7 +44,10 @@ module SmartCore::Engine::Frozener
|
|
|
44
44
|
# @since 0.8.0
|
|
45
45
|
# @version 0.9.0
|
|
46
46
|
def freeze(object)
|
|
47
|
+
# rubocop:disable Performance/BindCall
|
|
48
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
47
49
|
FROZENER.bind(object).call
|
|
50
|
+
# rubocop:enable Performance/BindCall
|
|
48
51
|
end
|
|
49
52
|
|
|
50
53
|
# @param object [Any]
|
|
@@ -54,7 +57,10 @@ module SmartCore::Engine::Frozener
|
|
|
54
57
|
# @since 0.8.0
|
|
55
58
|
# @version 0.9.0
|
|
56
59
|
def frozen?(object)
|
|
60
|
+
# rubocop:disable Performance/BindCall
|
|
61
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
57
62
|
FROZEN_CHECK.bind(object).call
|
|
63
|
+
# rubocop:enable Performance/BindCall
|
|
58
64
|
end
|
|
59
65
|
end
|
|
60
66
|
end
|
data/lib/smart_core/engine.rb
CHANGED
data/lib/smart_core/errors.rb
CHANGED
|
@@ -19,13 +19,14 @@ module SmartCore
|
|
|
19
19
|
|
|
20
20
|
# @api public
|
|
21
21
|
# @since 0.2.0
|
|
22
|
-
FrozenError =
|
|
22
|
+
FrozenError = # rubocop:disable Naming/ConstantName
|
|
23
23
|
# :nocov:
|
|
24
|
+
# rubocop:disable Layout/CommentIndentation
|
|
24
25
|
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
|
|
25
26
|
Class.new(::FrozenError)
|
|
26
27
|
else
|
|
27
28
|
Class.new(::RuntimeError)
|
|
28
29
|
end
|
|
29
30
|
# :nocov:
|
|
30
|
-
|
|
31
|
+
# rubocop:enable Layout/CommentIndentation
|
|
31
32
|
end
|
|
@@ -13,6 +13,7 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
13
13
|
_hash = _m_obj.method(:hash).unbind.tap(&:freeze)
|
|
14
14
|
_nil = _m_obj.method(:nil?).unbind.tap(&:freeze)
|
|
15
15
|
_instance_of = _m_obj.method(:instance_of?).unbind.tap(&:freeze)
|
|
16
|
+
_inspect = _m_obj.method(:inspect).unbind.tap(&:freeze)
|
|
16
17
|
|
|
17
18
|
# @note Object#is_a? behavior copy
|
|
18
19
|
# @param klass [Class]
|
|
@@ -21,7 +22,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
21
22
|
# @api public
|
|
22
23
|
# @since 0.9.0
|
|
23
24
|
define_method(:is_a?) do |klass|
|
|
25
|
+
# rubocop:disable Performance/BindCall
|
|
26
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
24
27
|
_is_a.bind(self).call(klass)
|
|
28
|
+
# rubocop:enable Performance/BindCall
|
|
25
29
|
end
|
|
26
30
|
alias_method :kind_of?, :is_a?
|
|
27
31
|
|
|
@@ -31,7 +35,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
31
35
|
# @api public
|
|
32
36
|
# @since 0.9.0
|
|
33
37
|
define_method(:freeze) do
|
|
38
|
+
# rubocop:disable Performance/BindCall
|
|
39
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
34
40
|
_freeze.bind(self).call
|
|
41
|
+
# rubocop:enable Performance/BindCall
|
|
35
42
|
end
|
|
36
43
|
|
|
37
44
|
# @note Object#frozen? behavior copy
|
|
@@ -40,7 +47,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
40
47
|
# @api public
|
|
41
48
|
# @since 0.9.0
|
|
42
49
|
define_method(:frozen?) do
|
|
50
|
+
# rubocop:disable Performance/BindCall
|
|
51
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
43
52
|
_frozen.bind(self).call
|
|
53
|
+
# rubocop:enable Performance/BindCall
|
|
44
54
|
end
|
|
45
55
|
|
|
46
56
|
# @return [Integer]
|
|
@@ -48,7 +58,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
48
58
|
# @api public
|
|
49
59
|
# @since 0.10.0
|
|
50
60
|
define_method(:hash) do
|
|
61
|
+
# rubocop:disable Performance/BindCall
|
|
62
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
51
63
|
_hash.bind(self).call
|
|
64
|
+
# rubocop:enable Performance/BindCall
|
|
52
65
|
end
|
|
53
66
|
|
|
54
67
|
# @return [Boolean]
|
|
@@ -56,7 +69,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
56
69
|
# @api public
|
|
57
70
|
# @since 0.10.0
|
|
58
71
|
define_method(:nil?) do
|
|
72
|
+
# rubocop:disable Performance/BindCall
|
|
73
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
59
74
|
_nil.bind(self).call
|
|
75
|
+
# rubocop:enable Performance/BindCall
|
|
60
76
|
end
|
|
61
77
|
|
|
62
78
|
# @return [Boolean]
|
|
@@ -64,7 +80,21 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
64
80
|
# @api public
|
|
65
81
|
# @since 0.1.0
|
|
66
82
|
define_method(:instance_of?) do |klass|
|
|
83
|
+
# rubocop:disable Performance/BindCall
|
|
84
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
67
85
|
_instance_of.bind(self).call(klass)
|
|
86
|
+
# rubocop:enable Performance/BindCall
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# @return [String]
|
|
90
|
+
#
|
|
91
|
+
# @api public
|
|
92
|
+
# @since 0.12.0
|
|
93
|
+
define_method(:inspect) do
|
|
94
|
+
# rubocop:disable Performance/BindCall
|
|
95
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
96
|
+
_inspect.bind(self).call
|
|
97
|
+
# rubocop:enable Performance/BindCall
|
|
68
98
|
end
|
|
69
99
|
end
|
|
70
100
|
end
|
data/smart_engine.gemspec
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require_relative 'lib/smart_core/engine/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
|
6
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
|
|
7
7
|
|
|
8
8
|
spec.name = 'smart_engine'
|
|
9
9
|
spec.version = SmartCore::Engine::VERSION
|
|
@@ -34,10 +34,10 @@ Gem::Specification.new do |spec|
|
|
|
34
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
35
35
|
spec.require_paths = ['lib']
|
|
36
36
|
|
|
37
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
|
37
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
39
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
|
40
|
-
spec.add_development_dependency 'armitage-rubocop', '~> 1.
|
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.11'
|
|
40
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 1.30'
|
|
41
41
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
|
42
|
-
spec.add_development_dependency 'pry', '~> 0.
|
|
42
|
+
spec.add_development_dependency 'pry', '~> 0.14'
|
|
43
43
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smart_engine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rustam Ibragimov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-09-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '2.
|
|
19
|
+
version: '2.3'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '2.
|
|
26
|
+
version: '2.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,28 +44,28 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '3.
|
|
47
|
+
version: '3.11'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '3.
|
|
54
|
+
version: '3.11'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: armitage-rubocop
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '1.
|
|
61
|
+
version: '1.30'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '1.
|
|
68
|
+
version: '1.30'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: simplecov
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0.
|
|
89
|
+
version: '0.14'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0.
|
|
96
|
+
version: '0.14'
|
|
97
97
|
description: 'SmartCore Engine - a set of core functionality shared beetwen a series
|
|
98
98
|
of SmartCore gems.
|
|
99
99
|
|
|
@@ -119,6 +119,7 @@ files:
|
|
|
119
119
|
- lib/smart_core.rb
|
|
120
120
|
- lib/smart_core/engine.rb
|
|
121
121
|
- lib/smart_core/engine/atom.rb
|
|
122
|
+
- lib/smart_core/engine/cache.rb
|
|
122
123
|
- lib/smart_core/engine/ext.rb
|
|
123
124
|
- lib/smart_core/engine/frozener.rb
|
|
124
125
|
- lib/smart_core/engine/lock.rb
|
|
@@ -143,14 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
143
144
|
requirements:
|
|
144
145
|
- - ">="
|
|
145
146
|
- !ruby/object:Gem::Version
|
|
146
|
-
version: 2.
|
|
147
|
+
version: '2.5'
|
|
147
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
requirements:
|
|
149
150
|
- - ">="
|
|
150
151
|
- !ruby/object:Gem::Version
|
|
151
152
|
version: '0'
|
|
152
153
|
requirements: []
|
|
153
|
-
rubygems_version: 3.
|
|
154
|
+
rubygems_version: 3.3.11
|
|
154
155
|
signing_key:
|
|
155
156
|
specification_version: 4
|
|
156
157
|
summary: SmartCore Engine - a generic subset of SmartCore's functionality.
|