smart_engine 0.6.0 → 0.11.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 +6 -1
- data/CHANGELOG.md +33 -0
- data/Gemfile.lock +63 -57
- data/README.md +100 -0
- data/lib/smart_core.rb +1 -0
- data/lib/smart_core/engine.rb +2 -0
- data/lib/smart_core/engine/atom.rb +43 -0
- data/lib/smart_core/engine/ext.rb +7 -0
- data/lib/smart_core/engine/frozener.rb +60 -0
- data/lib/smart_core/engine/version.rb +2 -2
- data/lib/smart_core/ext.rb +7 -0
- data/lib/smart_core/ext/basic_object_as_object.rb +70 -0
- data/smart_engine.gemspec +4 -4
- metadata +19 -15
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '087b1dbf9ee51ac25529cffbb42796a6fcf9fefe5a6450dd55b422f731f24ea5'
|
4
|
+
data.tar.gz: 4ec414dbbf3f033a2051a8f88b9b9304f0741f8b7330d65238dcd4a6b95e4f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed532ab1c5d773bdc8b9a2156f70d41b8b68725e812a5a89c5f2576c8595e60c081756dc6427cfe5f53c758cb094078c994aa614c76b3e057f99e87ed0a7e3d
|
7
|
+
data.tar.gz: 3748b43ed40a12b4d65e32b85a87d9ff790791c1987962b2377751a2e6a66d9a877b33dd450b8d2aadaad192d03f3183d272b555236afac538b86ee149d4376f
|
data/.rubocop.yml
CHANGED
@@ -5,7 +5,8 @@ inherit_gem:
|
|
5
5
|
- lib/rubocop.rspec.yml
|
6
6
|
|
7
7
|
AllCops:
|
8
|
-
TargetRubyVersion: 2.7.
|
8
|
+
TargetRubyVersion: 2.7.2
|
9
|
+
NewCops: enable
|
9
10
|
Include:
|
10
11
|
- lib/**/*.rb
|
11
12
|
- spec/**/*.rb
|
@@ -13,3 +14,7 @@ AllCops:
|
|
13
14
|
- Rakefile
|
14
15
|
- smart_engine.gemspec
|
15
16
|
- bin/console
|
17
|
+
|
18
|
+
# NOTE: for better representativeness of test examples
|
19
|
+
RSpec/DescribedClass:
|
20
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,39 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.11.0] - 2021-01-17
|
5
|
+
### Added
|
6
|
+
- Support for *Ruby@3*;
|
7
|
+
|
8
|
+
## [0.10.0] - 2020-12-22
|
9
|
+
### Added
|
10
|
+
- Support for `#hash` and `#instance_of?` for `SmartCore::Ext::BasicObjectAsObject` refinement;
|
11
|
+
|
12
|
+
## [0.9.0] - 2020-12-20
|
13
|
+
### Added
|
14
|
+
- New type of utilities: *Extensions* (`SmartCore::Ext`);
|
15
|
+
- New extension: `SmartCore::Ext::BasicObjectAsObject` refinement:
|
16
|
+
- `using SmartCore::Ext::BasicObjectAsObject` provides native support for:
|
17
|
+
- `BasicObject#is_a?`;
|
18
|
+
- `BasicObject#kind_of?`;
|
19
|
+
- `BasicObject#freeze`;
|
20
|
+
- `BasicObject#frozen?`;
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
- Updated development dependencies;
|
24
|
+
- Support for *Ruby@2.4* has ended;
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
- `SmartCore::Engine::Frozener` can not be used with rubies lower than `@2.7`;
|
28
|
+
|
29
|
+
## [0.8.0] - 2020-07-25
|
30
|
+
### Added
|
31
|
+
- Any object frozener (`SmartCore::Engine::Frozener`, `SmartCore::Engine::Frozener::Mixin`);
|
32
|
+
|
33
|
+
## [0.7.0] - 2020-07-03
|
34
|
+
### Added
|
35
|
+
- Atomic threadsafe value container (`SmartCore::Engine::Atom`);
|
36
|
+
|
4
37
|
## [0.6.0] - 2020-05-03
|
5
38
|
### Added
|
6
39
|
- Inline rescue pipe (`SmartCore::Engine::RescueExt.inline_rescue_pipe`);
|
data/Gemfile.lock
CHANGED
@@ -1,96 +1,102 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_engine (0.
|
4
|
+
smart_engine (0.11.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (6.
|
9
|
+
activesupport (6.1.1)
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
|
-
i18n (>=
|
12
|
-
minitest (
|
13
|
-
tzinfo (~>
|
14
|
-
zeitwerk (~> 2.
|
15
|
-
armitage-rubocop (
|
16
|
-
rubocop (=
|
17
|
-
rubocop-performance (= 1.
|
18
|
-
rubocop-rails (= 2.
|
11
|
+
i18n (>= 1.6, < 2)
|
12
|
+
minitest (>= 5.1)
|
13
|
+
tzinfo (~> 2.0)
|
14
|
+
zeitwerk (~> 2.3)
|
15
|
+
armitage-rubocop (1.7.0.1)
|
16
|
+
rubocop (= 1.7.0)
|
17
|
+
rubocop-performance (= 1.9.1)
|
18
|
+
rubocop-rails (= 2.9.1)
|
19
19
|
rubocop-rake (= 0.5.1)
|
20
|
-
rubocop-rspec (= 1.
|
21
|
-
ast (2.4.
|
22
|
-
coderay (1.1.
|
23
|
-
concurrent-ruby (1.1.
|
24
|
-
diff-lcs (1.
|
25
|
-
docile (1.3.
|
26
|
-
i18n (1.8.
|
20
|
+
rubocop-rspec (= 2.1.0)
|
21
|
+
ast (2.4.1)
|
22
|
+
coderay (1.1.3)
|
23
|
+
concurrent-ruby (1.1.7)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
docile (1.3.5)
|
26
|
+
i18n (1.8.7)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
|
-
jaro_winkler (1.5.4)
|
29
28
|
method_source (1.0.0)
|
30
|
-
minitest (5.14.
|
31
|
-
parallel (1.
|
32
|
-
parser (
|
33
|
-
ast (~> 2.4.
|
29
|
+
minitest (5.14.3)
|
30
|
+
parallel (1.20.1)
|
31
|
+
parser (3.0.0.0)
|
32
|
+
ast (~> 2.4.1)
|
34
33
|
pry (0.13.1)
|
35
34
|
coderay (~> 1.1)
|
36
35
|
method_source (~> 1.0)
|
37
|
-
rack (2.2.
|
36
|
+
rack (2.2.3)
|
38
37
|
rainbow (3.0.0)
|
39
|
-
rake (13.0.
|
38
|
+
rake (13.0.3)
|
39
|
+
regexp_parser (2.0.3)
|
40
40
|
rexml (3.2.4)
|
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.
|
41
|
+
rspec (3.10.0)
|
42
|
+
rspec-core (~> 3.10.0)
|
43
|
+
rspec-expectations (~> 3.10.0)
|
44
|
+
rspec-mocks (~> 3.10.0)
|
45
|
+
rspec-core (3.10.1)
|
46
|
+
rspec-support (~> 3.10.0)
|
47
|
+
rspec-expectations (3.10.1)
|
48
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-mocks (3.10.1)
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-support (3.
|
54
|
-
rubocop (
|
55
|
-
jaro_winkler (~> 1.5.1)
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-support (3.10.1)
|
54
|
+
rubocop (1.7.0)
|
56
55
|
parallel (~> 1.10)
|
57
|
-
parser (>= 2.7.
|
56
|
+
parser (>= 2.7.1.5)
|
58
57
|
rainbow (>= 2.2.2, < 4.0)
|
58
|
+
regexp_parser (>= 1.8, < 3.0)
|
59
59
|
rexml
|
60
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
60
61
|
ruby-progressbar (~> 1.7)
|
61
62
|
unicode-display_width (>= 1.4.0, < 2.0)
|
62
|
-
rubocop-
|
63
|
-
|
64
|
-
rubocop-
|
65
|
-
|
63
|
+
rubocop-ast (1.4.0)
|
64
|
+
parser (>= 2.7.1.5)
|
65
|
+
rubocop-performance (1.9.1)
|
66
|
+
rubocop (>= 0.90.0, < 2.0)
|
67
|
+
rubocop-ast (>= 0.4.0)
|
68
|
+
rubocop-rails (2.9.1)
|
69
|
+
activesupport (>= 4.2.0)
|
66
70
|
rack (>= 1.1)
|
67
|
-
rubocop (>= 0.
|
71
|
+
rubocop (>= 0.90.0, < 2.0)
|
68
72
|
rubocop-rake (0.5.1)
|
69
73
|
rubocop
|
70
|
-
rubocop-rspec (1.
|
71
|
-
rubocop (
|
72
|
-
|
73
|
-
|
74
|
+
rubocop-rspec (2.1.0)
|
75
|
+
rubocop (~> 1.0)
|
76
|
+
rubocop-ast (>= 1.1.0)
|
77
|
+
ruby-progressbar (1.11.0)
|
78
|
+
simplecov (0.21.2)
|
74
79
|
docile (~> 1.1)
|
75
80
|
simplecov-html (~> 0.11)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
81
|
+
simplecov_json_formatter (~> 0.1)
|
82
|
+
simplecov-html (0.12.3)
|
83
|
+
simplecov_json_formatter (0.1.2)
|
84
|
+
tzinfo (2.0.4)
|
85
|
+
concurrent-ruby (~> 1.0)
|
80
86
|
unicode-display_width (1.7.0)
|
81
|
-
zeitwerk (2.
|
87
|
+
zeitwerk (2.4.2)
|
82
88
|
|
83
89
|
PLATFORMS
|
84
90
|
ruby
|
85
91
|
|
86
92
|
DEPENDENCIES
|
87
|
-
armitage-rubocop (~>
|
88
|
-
bundler (~> 2.
|
93
|
+
armitage-rubocop (~> 1.7)
|
94
|
+
bundler (~> 2.2)
|
89
95
|
pry (~> 0.13)
|
90
96
|
rake (~> 13.0)
|
91
|
-
rspec (~> 3.
|
92
|
-
simplecov (~> 0.
|
97
|
+
rspec (~> 3.10)
|
98
|
+
simplecov (~> 0.21)
|
93
99
|
smart_engine!
|
94
100
|
|
95
101
|
BUNDLED WITH
|
96
|
-
2.
|
102
|
+
2.2.3
|
data/README.md
CHANGED
@@ -24,7 +24,11 @@ require 'smart_core'
|
|
24
24
|
|
25
25
|
- [Global set of error types](#global-set-of-error-types)
|
26
26
|
- [Simple reentrant lock](#simple-reentrant-lock)
|
27
|
+
- [Atomic thread-safe value container](#atomic-thread-safe-value-container)
|
28
|
+
- [Any Object Frozener](#any-object-frozener) (classic c-level `frozen?`/`freeze`)
|
29
|
+
- [Basic Object Refinements](#basic-object-refinements) (`SmartCore::Ext::BasicObjectAsObject`)
|
27
30
|
- [Inline rescue pipe](#inline-rescue-pipe)
|
31
|
+
- [Roadmap](#roadmap)
|
28
32
|
|
29
33
|
---
|
30
34
|
|
@@ -47,6 +51,96 @@ lock.synchronize { your_code }
|
|
47
51
|
|
48
52
|
---
|
49
53
|
|
54
|
+
### Atomic thread-safe value container
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
atom = SmartCore::Engine::Atom.new # initial value - nil
|
58
|
+
atom.value # => nil
|
59
|
+
# --- or ---
|
60
|
+
atom = SmartCore::Engine::Atom.new(7) # initial value - 7
|
61
|
+
atom.value # => 7
|
62
|
+
|
63
|
+
# set new value (thread-safely)
|
64
|
+
atom.swap { |original_value| original_value * 2 }
|
65
|
+
atom.value # => 14
|
66
|
+
```
|
67
|
+
|
68
|
+
---
|
69
|
+
|
70
|
+
### Any Object Frozener
|
71
|
+
|
72
|
+
- works with any type of ruby objects (event with `BasicObject`);
|
73
|
+
- uses classic Ruby C-level `frozen?`/`freeze` functionality;
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
# as a singleton
|
77
|
+
|
78
|
+
object = BasicObject.new
|
79
|
+
SmartCore::Engine::Frozener.frozen?(object) # => false
|
80
|
+
|
81
|
+
SmartCore::Engine::Frozener.freeze(object)
|
82
|
+
SmartCore::Engine::Frozener.frozen?(object) # => true
|
83
|
+
```
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
# as a mixin
|
87
|
+
|
88
|
+
class EmptyObject < BasicObject
|
89
|
+
include SmartCore::Engine::Frozener::Mixin
|
90
|
+
end
|
91
|
+
|
92
|
+
object = EmptyObject.new
|
93
|
+
|
94
|
+
object.frozen? # => false
|
95
|
+
object.freeze
|
96
|
+
object.frozen? # => true
|
97
|
+
```
|
98
|
+
|
99
|
+
---
|
100
|
+
|
101
|
+
### Basic Object Refinements
|
102
|
+
|
103
|
+
Ruby's `BasicObject` class does not have some fundamental (extremely important for instrumenting) methods:
|
104
|
+
|
105
|
+
- `is_a?` / `kind_of?`
|
106
|
+
- `instance_of?`
|
107
|
+
- `freeze` / `frozen?`
|
108
|
+
- `hash`
|
109
|
+
- `nil?`
|
110
|
+
|
111
|
+
`SmartCore::Ext::BasicObjectAsObject` refinement solves this problem (by Ruby's internal API without any manualy-emulated behavior).
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
# without refinement:
|
115
|
+
basic_obj = ::BasicObject.new
|
116
|
+
|
117
|
+
basic_obj.is_a?(::BasicObject) # raises ::NoMethodError
|
118
|
+
basic_obj.kind_of?(::BasicObject) # raises ::NoMethodError
|
119
|
+
basic_obj.instance_of?(::BasicObject) # rasies ::NoMethodError
|
120
|
+
basic_obj.freeze # raises ::NoMethodError
|
121
|
+
basic_obj.frozen? # raises ::NoMethodError
|
122
|
+
```
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
# with refinement:
|
126
|
+
using SmartCore::Ext::BasicObjectAsObject
|
127
|
+
|
128
|
+
basic_obj = ::BasicObject.new
|
129
|
+
|
130
|
+
basic_obj.is_a?(::BasicObject) # => true
|
131
|
+
basic_obj.kind_of?(::BasicObject) # => true
|
132
|
+
basic_obj.instance_of?(::BasicObject) # => true
|
133
|
+
basic_obj.instance_of?(::Object) # => false
|
134
|
+
basic_obj.is_a?(::Integer) # => false
|
135
|
+
basic_obj.kind_of?(::Integer) # => false
|
136
|
+
|
137
|
+
basic_obj.frozen? # => false
|
138
|
+
basic_obj.freeze # => self
|
139
|
+
basic_obj.frozen? # => true
|
140
|
+
```
|
141
|
+
|
142
|
+
---
|
143
|
+
|
50
144
|
### Inline rescue pipe
|
51
145
|
|
52
146
|
- works with an array of proc objects;
|
@@ -93,6 +187,12 @@ end
|
|
93
187
|
|
94
188
|
---
|
95
189
|
|
190
|
+
## Roadmap
|
191
|
+
|
192
|
+
- thread-safety for BasicObject extensions;
|
193
|
+
|
194
|
+
---
|
195
|
+
|
96
196
|
## Contributing
|
97
197
|
|
98
198
|
- Fork it ( https://github.com/smart-rb/smart_engine )
|
data/lib/smart_core.rb
CHANGED
data/lib/smart_core/engine.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api public
|
4
|
+
# @since 0.7.0
|
5
|
+
class SmartCore::Engine::Atom
|
6
|
+
# @param initial_value [Any]
|
7
|
+
# @return [void]
|
8
|
+
#
|
9
|
+
# @api private
|
10
|
+
# @since 0.7.0
|
11
|
+
def initialize(initial_value = nil)
|
12
|
+
@value = initial_value
|
13
|
+
@barrier = SmartCore::Engine::Lock.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Any]
|
17
|
+
#
|
18
|
+
# @api public
|
19
|
+
# @since 0.7.0
|
20
|
+
def value
|
21
|
+
with_barrier { @value }
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param block [Block]
|
25
|
+
# @return [Any]
|
26
|
+
#
|
27
|
+
# @api public
|
28
|
+
# @since 0.7.0
|
29
|
+
def swap(&block)
|
30
|
+
with_barrier { @value = yield(@value) }
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# @param block [Block]
|
36
|
+
# @return [Any]
|
37
|
+
#
|
38
|
+
# @api private
|
39
|
+
# @since 0.1.0
|
40
|
+
def with_barrier(&block)
|
41
|
+
@barrier.synchronize(&block)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api public
|
4
|
+
# @since 0.8.0
|
5
|
+
# @version 0.9.0
|
6
|
+
module SmartCore::Engine::Frozener
|
7
|
+
# @api public
|
8
|
+
# @since 0.8.0
|
9
|
+
module Mixin
|
10
|
+
# @return [self]
|
11
|
+
#
|
12
|
+
# @api public
|
13
|
+
# @since 0.8.0
|
14
|
+
def freeze
|
15
|
+
SmartCore::Engine::Frozener.freeze(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Boolean]
|
19
|
+
#
|
20
|
+
# @api public
|
21
|
+
# @since 0.8.0
|
22
|
+
def frozen?
|
23
|
+
SmartCore::Engine::Frozener.frozen?(self)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [UnboundMethod]
|
28
|
+
#
|
29
|
+
# @api private
|
30
|
+
# @since 0.8.0
|
31
|
+
FROZENER = Object.new.method(:freeze).unbind.tap(&:freeze)
|
32
|
+
|
33
|
+
# @return [UnboundMethod]
|
34
|
+
#
|
35
|
+
# @api private
|
36
|
+
# @since 0.8.0
|
37
|
+
FROZEN_CHECK = Object.new.method(:frozen?).unbind.tap(&:freeze)
|
38
|
+
|
39
|
+
class << self
|
40
|
+
# @param object [Any]
|
41
|
+
# @return [object]
|
42
|
+
#
|
43
|
+
# @api public
|
44
|
+
# @since 0.8.0
|
45
|
+
# @version 0.9.0
|
46
|
+
def freeze(object)
|
47
|
+
FROZENER.bind(object).call
|
48
|
+
end
|
49
|
+
|
50
|
+
# @param object [Any]
|
51
|
+
# @return [Boolean]
|
52
|
+
#
|
53
|
+
# @api public
|
54
|
+
# @since 0.8.0
|
55
|
+
# @version 0.9.0
|
56
|
+
def frozen?(object)
|
57
|
+
FROZEN_CHECK.bind(object).call
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api public
|
4
|
+
# @since 0.9.0
|
5
|
+
# @version 0.10.0
|
6
|
+
module SmartCore::Ext::BasicObjectAsObject
|
7
|
+
refine BasicObject do
|
8
|
+
_m_obj = ::Object.new
|
9
|
+
|
10
|
+
_is_a = _m_obj.method(:is_a?).unbind.tap(&:freeze)
|
11
|
+
_freeze = _m_obj.method(:freeze).unbind.tap(&:freeze)
|
12
|
+
_frozen = _m_obj.method(:frozen?).unbind.tap(&:freeze)
|
13
|
+
_hash = _m_obj.method(:hash).unbind.tap(&:freeze)
|
14
|
+
_nil = _m_obj.method(:nil?).unbind.tap(&:freeze)
|
15
|
+
_instance_of = _m_obj.method(:instance_of?).unbind.tap(&:freeze)
|
16
|
+
|
17
|
+
# @note Object#is_a? behavior copy
|
18
|
+
# @param klass [Class]
|
19
|
+
# @return [Boolean]
|
20
|
+
#
|
21
|
+
# @api public
|
22
|
+
# @since 0.9.0
|
23
|
+
define_method(:is_a?) do |klass|
|
24
|
+
_is_a.bind(self).call(klass)
|
25
|
+
end
|
26
|
+
alias_method :kind_of?, :is_a?
|
27
|
+
|
28
|
+
# @note Object#freeze behavior copy
|
29
|
+
# @return [self]
|
30
|
+
#
|
31
|
+
# @api public
|
32
|
+
# @since 0.9.0
|
33
|
+
define_method(:freeze) do
|
34
|
+
_freeze.bind(self).call
|
35
|
+
end
|
36
|
+
|
37
|
+
# @note Object#frozen? behavior copy
|
38
|
+
# @return [Boolean]
|
39
|
+
#
|
40
|
+
# @api public
|
41
|
+
# @since 0.9.0
|
42
|
+
define_method(:frozen?) do
|
43
|
+
_frozen.bind(self).call
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [Integer]
|
47
|
+
#
|
48
|
+
# @api public
|
49
|
+
# @since 0.10.0
|
50
|
+
define_method(:hash) do
|
51
|
+
_hash.bind(self).call
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [Boolean]
|
55
|
+
#
|
56
|
+
# @api public
|
57
|
+
# @since 0.10.0
|
58
|
+
define_method(:nil?) do
|
59
|
+
_nil.bind(self).call
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [Boolean]
|
63
|
+
#
|
64
|
+
# @api public
|
65
|
+
# @since 0.1.0
|
66
|
+
define_method(:instance_of?) do |klass|
|
67
|
+
_instance_of.bind(self).call(klass)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/smart_engine.gemspec
CHANGED
@@ -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.2'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
40
|
-
spec.add_development_dependency 'armitage-rubocop', '~>
|
41
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
40
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 1.7'
|
41
|
+
spec.add_development_dependency 'simplecov', '~> 0.21'
|
42
42
|
spec.add_development_dependency 'pry', '~> 0.13'
|
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.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-17 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.2'
|
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.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,42 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.10'
|
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.10'
|
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: '
|
61
|
+
version: '1.7'
|
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: '
|
68
|
+
version: '1.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.21'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.21'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- ".gitignore"
|
108
108
|
- ".rspec"
|
109
109
|
- ".rubocop.yml"
|
110
|
-
- ".travis.yml"
|
111
110
|
- CHANGELOG.md
|
112
111
|
- CODE_OF_CONDUCT.md
|
113
112
|
- Gemfile
|
@@ -119,10 +118,15 @@ files:
|
|
119
118
|
- bin/setup
|
120
119
|
- lib/smart_core.rb
|
121
120
|
- lib/smart_core/engine.rb
|
121
|
+
- lib/smart_core/engine/atom.rb
|
122
|
+
- lib/smart_core/engine/ext.rb
|
123
|
+
- lib/smart_core/engine/frozener.rb
|
122
124
|
- lib/smart_core/engine/lock.rb
|
123
125
|
- lib/smart_core/engine/rescue_ext.rb
|
124
126
|
- lib/smart_core/engine/version.rb
|
125
127
|
- lib/smart_core/errors.rb
|
128
|
+
- lib/smart_core/ext.rb
|
129
|
+
- lib/smart_core/ext/basic_object_as_object.rb
|
126
130
|
- smart_engine.gemspec
|
127
131
|
homepage: https://github.com/smart-rb/smart_engine
|
128
132
|
licenses:
|
@@ -131,7 +135,7 @@ metadata:
|
|
131
135
|
homepage_uri: https://github.com/smart-rb/smart_engine
|
132
136
|
source_code_uri: https://github.com/smart-rb/smart_engine
|
133
137
|
changelog_uri: https://github.com/smart-rb/smart_engine/blob/master/CHANGELOG.md
|
134
|
-
post_install_message:
|
138
|
+
post_install_message:
|
135
139
|
rdoc_options: []
|
136
140
|
require_paths:
|
137
141
|
- lib
|
@@ -146,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
150
|
- !ruby/object:Gem::Version
|
147
151
|
version: '0'
|
148
152
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
153
|
+
rubygems_version: 3.2.3
|
154
|
+
signing_key:
|
151
155
|
specification_version: 4
|
152
156
|
summary: SmartCore Engine - a generic subset of SmartCore's functionality.
|
153
157
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
before_install: gem install bundler
|
5
|
-
os: linux
|
6
|
-
dist: xenial
|
7
|
-
script:
|
8
|
-
- bundle exec rake rubocop
|
9
|
-
- bundle exec rake rspec
|
10
|
-
jobs:
|
11
|
-
fast_finish: true
|
12
|
-
include:
|
13
|
-
- rvm: 2.4.10
|
14
|
-
- rvm: 2.5.8
|
15
|
-
- rvm: 2.6.6
|
16
|
-
- rvm: 2.7.1
|
17
|
-
- rvm: ruby-head
|
18
|
-
- rvm: jruby-head
|
19
|
-
allow_failures:
|
20
|
-
- rvm: ruby-head
|
21
|
-
- rvm: jruby-head
|