smart_engine 0.12.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 +8 -0
- data/Gemfile.lock +56 -59
- data/README.md +69 -0
- 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 +21 -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,6 +1,14 @@
|
|
|
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
|
+
|
|
4
12
|
## [0.12.0] - 2021-12-09
|
|
5
13
|
### Added
|
|
6
14
|
- `using SmartCore::Ext::BasicObjectAsObject` provides native support for:
|
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/README.md
CHANGED
|
@@ -34,11 +34,13 @@ require 'smart_core'
|
|
|
34
34
|
|
|
35
35
|
- [Global set of error types](#global-set-of-error-types)
|
|
36
36
|
- [Simple reentrant lock](#simple-reentrant-lock)
|
|
37
|
+
- [Cache Storage](#cache-storage)
|
|
37
38
|
- [Atomic thread-safe value container](#atomic-thread-safe-value-container)
|
|
38
39
|
- [Any Object Frozener](#any-object-frozener) (classic c-level `frozen?`/`freeze`)
|
|
39
40
|
- [Basic Object Refinements](#basic-object-refinements) (`SmartCore::Ext::BasicObjectAsObject`)
|
|
40
41
|
- [Inline rescue pipe](#inline-rescue-pipe)
|
|
41
42
|
|
|
43
|
+
|
|
42
44
|
---
|
|
43
45
|
|
|
44
46
|
### Global set of error types
|
|
@@ -60,6 +62,62 @@ lock.synchronize { your_code }
|
|
|
60
62
|
|
|
61
63
|
---
|
|
62
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
|
+
|
|
63
121
|
### Atomic thread-safe value container
|
|
64
122
|
|
|
65
123
|
```ruby
|
|
@@ -116,6 +174,7 @@ Ruby's `BasicObject` class does not have some fundamental (extremely important f
|
|
|
116
174
|
- `freeze` / `frozen?`
|
|
117
175
|
- `hash`
|
|
118
176
|
- `nil?`
|
|
177
|
+
- `inspect`
|
|
119
178
|
|
|
120
179
|
`SmartCore::Ext::BasicObjectAsObject` refinement solves this problem (by Ruby's internal API without any manualy-emulated behavior).
|
|
121
180
|
|
|
@@ -130,6 +189,7 @@ basic_obj.freeze # raises ::NoMethodError
|
|
|
130
189
|
basic_obj.frozen? # raises ::NoMethodError
|
|
131
190
|
basic_object.hash # raises ::NoMethodError
|
|
132
191
|
basic_object.nil? # raises ::NoMethodError
|
|
192
|
+
basic_object.inspect # raises ::NoMethodError
|
|
133
193
|
```
|
|
134
194
|
|
|
135
195
|
```ruby
|
|
@@ -152,6 +212,8 @@ basic_obj.frozen? # => true
|
|
|
152
212
|
basic_obj.nil? # => false
|
|
153
213
|
|
|
154
214
|
basic_obj.hash # => 2682859680348634421 (some Integer value)
|
|
215
|
+
|
|
216
|
+
basic_obj.inspect # => "#<BasicObject:0x00007fe428018628>"
|
|
155
217
|
```
|
|
156
218
|
|
|
157
219
|
---
|
|
@@ -206,6 +268,13 @@ end
|
|
|
206
268
|
|
|
207
269
|
- migrate to Github Actions in CI;
|
|
208
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;
|
|
209
278
|
|
|
210
279
|
---
|
|
211
280
|
|
|
@@ -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
|
|
@@ -22,7 +22,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
22
22
|
# @api public
|
|
23
23
|
# @since 0.9.0
|
|
24
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
|
|
25
27
|
_is_a.bind(self).call(klass)
|
|
28
|
+
# rubocop:enable Performance/BindCall
|
|
26
29
|
end
|
|
27
30
|
alias_method :kind_of?, :is_a?
|
|
28
31
|
|
|
@@ -32,7 +35,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
32
35
|
# @api public
|
|
33
36
|
# @since 0.9.0
|
|
34
37
|
define_method(:freeze) do
|
|
38
|
+
# rubocop:disable Performance/BindCall
|
|
39
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
35
40
|
_freeze.bind(self).call
|
|
41
|
+
# rubocop:enable Performance/BindCall
|
|
36
42
|
end
|
|
37
43
|
|
|
38
44
|
# @note Object#frozen? behavior copy
|
|
@@ -41,7 +47,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
41
47
|
# @api public
|
|
42
48
|
# @since 0.9.0
|
|
43
49
|
define_method(:frozen?) do
|
|
50
|
+
# rubocop:disable Performance/BindCall
|
|
51
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
44
52
|
_frozen.bind(self).call
|
|
53
|
+
# rubocop:enable Performance/BindCall
|
|
45
54
|
end
|
|
46
55
|
|
|
47
56
|
# @return [Integer]
|
|
@@ -49,7 +58,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
49
58
|
# @api public
|
|
50
59
|
# @since 0.10.0
|
|
51
60
|
define_method(:hash) do
|
|
61
|
+
# rubocop:disable Performance/BindCall
|
|
62
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
52
63
|
_hash.bind(self).call
|
|
64
|
+
# rubocop:enable Performance/BindCall
|
|
53
65
|
end
|
|
54
66
|
|
|
55
67
|
# @return [Boolean]
|
|
@@ -57,7 +69,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
57
69
|
# @api public
|
|
58
70
|
# @since 0.10.0
|
|
59
71
|
define_method(:nil?) do
|
|
72
|
+
# rubocop:disable Performance/BindCall
|
|
73
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
60
74
|
_nil.bind(self).call
|
|
75
|
+
# rubocop:enable Performance/BindCall
|
|
61
76
|
end
|
|
62
77
|
|
|
63
78
|
# @return [Boolean]
|
|
@@ -65,7 +80,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
65
80
|
# @api public
|
|
66
81
|
# @since 0.1.0
|
|
67
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
|
|
68
85
|
_instance_of.bind(self).call(klass)
|
|
86
|
+
# rubocop:enable Performance/BindCall
|
|
69
87
|
end
|
|
70
88
|
|
|
71
89
|
# @return [String]
|
|
@@ -73,7 +91,10 @@ module SmartCore::Ext::BasicObjectAsObject
|
|
|
73
91
|
# @api public
|
|
74
92
|
# @since 0.12.0
|
|
75
93
|
define_method(:inspect) do
|
|
94
|
+
# rubocop:disable Performance/BindCall
|
|
95
|
+
# NOTE: disabled in order to support older Ruby versions than Ruby@3
|
|
76
96
|
_inspect.bind(self).call
|
|
97
|
+
# rubocop:enable Performance/BindCall
|
|
77
98
|
end
|
|
78
99
|
end
|
|
79
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.
|