smart_engine 0.7.0 → 0.8.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 +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +11 -11
- data/README.md +31 -0
- data/lib/smart_core/engine.rb +1 -0
- data/lib/smart_core/engine/frozener.rb +57 -0
- data/lib/smart_core/engine/version.rb +2 -2
- data/smart_engine.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 228fbd594308ecee71718fe059d6d8bf57f8e79f33b0607ca4b771fc498a0ac4
|
4
|
+
data.tar.gz: 809d274f771a7de133a1bc8986448ffca67bcefa2f0fd5f3a5d39cf730c448fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29eb3e3f8e005af66036b33c3bdb7260d8da6054dd63177b50d7a1bb0cd6b4a6ba39a61c03a77420a9d2867fbc4424a7a2718e535c0dd6afefa4f699c6c33beb
|
7
|
+
data.tar.gz: 70f57850d865a3dcbfbc083f444c30a86bd24745501e1816efff41db049c294ae5844f2c2bf6856316137a20d7be7b00c32964a852f576245ab0f378d40bb06e
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.8.0] - 2020-07-25
|
5
|
+
### Added
|
6
|
+
- Any object frozener (`SmartCore::Engine::Frozener`, `SmartCore::Engine::Frozener::Mixin`);
|
7
|
+
|
4
8
|
## [0.7.0] - 2020-07-03
|
5
9
|
### Added
|
6
10
|
- Atomic threadsafe value container (`SmartCore::Engine::Atom`);
|
data/Gemfile.lock
CHANGED
@@ -12,12 +12,12 @@ GEM
|
|
12
12
|
minitest (~> 5.1)
|
13
13
|
tzinfo (~> 1.1)
|
14
14
|
zeitwerk (~> 2.2, >= 2.2.2)
|
15
|
-
armitage-rubocop (0.
|
16
|
-
rubocop (= 0.
|
17
|
-
rubocop-performance (= 1.
|
15
|
+
armitage-rubocop (0.87.1)
|
16
|
+
rubocop (= 0.87.1)
|
17
|
+
rubocop-performance (= 1.7.0)
|
18
18
|
rubocop-rails (= 2.6.0)
|
19
19
|
rubocop-rake (= 0.5.1)
|
20
|
-
rubocop-rspec (= 1.
|
20
|
+
rubocop-rspec (= 1.41.0)
|
21
21
|
ast (2.4.1)
|
22
22
|
coderay (1.1.2)
|
23
23
|
concurrent-ruby (1.1.6)
|
@@ -51,26 +51,26 @@ GEM
|
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
52
|
rspec-support (~> 3.9.0)
|
53
53
|
rspec-support (3.9.3)
|
54
|
-
rubocop (0.
|
54
|
+
rubocop (0.87.1)
|
55
55
|
parallel (~> 1.10)
|
56
|
-
parser (>= 2.7.
|
56
|
+
parser (>= 2.7.1.1)
|
57
57
|
rainbow (>= 2.2.2, < 4.0)
|
58
58
|
regexp_parser (>= 1.7)
|
59
59
|
rexml
|
60
|
-
rubocop-ast (>= 0.0.
|
60
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
61
61
|
ruby-progressbar (~> 1.7)
|
62
62
|
unicode-display_width (>= 1.4.0, < 2.0)
|
63
63
|
rubocop-ast (0.1.0)
|
64
64
|
parser (>= 2.7.0.1)
|
65
|
-
rubocop-performance (1.
|
66
|
-
rubocop (>= 0.
|
65
|
+
rubocop-performance (1.7.0)
|
66
|
+
rubocop (>= 0.82.0)
|
67
67
|
rubocop-rails (2.6.0)
|
68
68
|
activesupport (>= 4.2.0)
|
69
69
|
rack (>= 1.1)
|
70
70
|
rubocop (>= 0.82.0)
|
71
71
|
rubocop-rake (0.5.1)
|
72
72
|
rubocop
|
73
|
-
rubocop-rspec (1.
|
73
|
+
rubocop-rspec (1.41.0)
|
74
74
|
rubocop (>= 0.68.1)
|
75
75
|
ruby-progressbar (1.10.1)
|
76
76
|
simplecov (0.18.5)
|
@@ -87,7 +87,7 @@ PLATFORMS
|
|
87
87
|
ruby
|
88
88
|
|
89
89
|
DEPENDENCIES
|
90
|
-
armitage-rubocop (~> 0.
|
90
|
+
armitage-rubocop (~> 0.87)
|
91
91
|
bundler (~> 2.1)
|
92
92
|
pry (~> 0.13)
|
93
93
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -25,6 +25,7 @@ require 'smart_core'
|
|
25
25
|
- [Global set of error types](#global-set-of-error-types)
|
26
26
|
- [Simple reentrant lock](#simple-reentrant-lock)
|
27
27
|
- [Atomic thread-safe value container](#atomic-thread-safe-value-container)
|
28
|
+
- [Any Object Frozener](#any-object-frozener)
|
28
29
|
- [Inline rescue pipe](#inline-rescue-pipe)
|
29
30
|
|
30
31
|
---
|
@@ -64,6 +65,36 @@ atom.value # => 14
|
|
64
65
|
|
65
66
|
---
|
66
67
|
|
68
|
+
### Any Object Frozener
|
69
|
+
|
70
|
+
- works with any type of ruby objects (event with `BasicObject`);
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
# as a singleton
|
74
|
+
|
75
|
+
object = BasicObject.new
|
76
|
+
SmartCore::Engine::Frozener.frozen?(object) # => false
|
77
|
+
|
78
|
+
SmartCore::Engine::Frozener.freeze(object)
|
79
|
+
SmartCore::Engine::Frozener.frozen?(object) # => true
|
80
|
+
```
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
# as a mixin
|
84
|
+
|
85
|
+
class EmptyObject < BasicObject
|
86
|
+
include SmartCore::Engine::Frozener::Mixin
|
87
|
+
end
|
88
|
+
|
89
|
+
object = EmptyObject.new
|
90
|
+
|
91
|
+
object.frozen? # => false
|
92
|
+
object.freeze
|
93
|
+
object.frozen? # => true
|
94
|
+
```
|
95
|
+
|
96
|
+
---
|
97
|
+
|
67
98
|
### Inline rescue pipe
|
68
99
|
|
69
100
|
- works with an array of proc objects;
|
data/lib/smart_core/engine.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api public
|
4
|
+
# @since 0.8.0
|
5
|
+
module SmartCore::Engine::Frozener
|
6
|
+
# @api public
|
7
|
+
# @since 0.8.0
|
8
|
+
module Mixin
|
9
|
+
# @return [self]
|
10
|
+
#
|
11
|
+
# @api public
|
12
|
+
# @since 0.8.0
|
13
|
+
def freeze
|
14
|
+
SmartCore::Engine::Frozener.freeze(self)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Boolean]
|
18
|
+
#
|
19
|
+
# @api public
|
20
|
+
# @since 0.8.0
|
21
|
+
def frozen?
|
22
|
+
SmartCore::Engine::Frozener.frozen?(self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [UnboundMethod]
|
27
|
+
#
|
28
|
+
# @api private
|
29
|
+
# @since 0.8.0
|
30
|
+
FROZENER = Object.new.method(:freeze).unbind.tap(&:freeze)
|
31
|
+
|
32
|
+
# @return [UnboundMethod]
|
33
|
+
#
|
34
|
+
# @api private
|
35
|
+
# @since 0.8.0
|
36
|
+
FROZEN_CHECK = Object.new.method(:frozen?).unbind.tap(&:freeze)
|
37
|
+
|
38
|
+
class << self
|
39
|
+
# @param object [Any]
|
40
|
+
# @return [object]
|
41
|
+
#
|
42
|
+
# @api public
|
43
|
+
# @since 0.8.0
|
44
|
+
def freeze(object)
|
45
|
+
FROZENER.bind_call(object)
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param object [Any]
|
49
|
+
# @return [Boolean]
|
50
|
+
#
|
51
|
+
# @api public
|
52
|
+
# @since 0.8.0
|
53
|
+
def frozen?(object)
|
54
|
+
FROZEN_CHECK.bind_call(object)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/smart_engine.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
40
|
-
spec.add_development_dependency 'armitage-rubocop', '~> 0.
|
40
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 0.87'
|
41
41
|
spec.add_development_dependency 'simplecov', '~> 0.18'
|
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.8.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: 2020-07-
|
11
|
+
date: 2020-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.87'
|
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: '0.
|
68
|
+
version: '0.87'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/smart_core.rb
|
121
121
|
- lib/smart_core/engine.rb
|
122
122
|
- lib/smart_core/engine/atom.rb
|
123
|
+
- lib/smart_core/engine/frozener.rb
|
123
124
|
- lib/smart_core/engine/lock.rb
|
124
125
|
- lib/smart_core/engine/rescue_ext.rb
|
125
126
|
- lib/smart_core/engine/version.rb
|