smart_engine 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +20 -5
- data/lib/smart_core/engine.rb +1 -0
- data/lib/smart_core/engine/lock.rb +22 -0
- data/lib/smart_core/engine/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9411f71246102241e6508d2aeda65cb13e988630379226451f8ade8a861244aa
|
4
|
+
data.tar.gz: b9a9b194acbb23a7bc0a51446b1b06f3272974a214d92d9cd71bd922bca823c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4bd7b3d0d0002e88f2d1e0d1a8bfb8a9bc71d76454c2d7e41e4cb37c1f277b8f1f7423331323ebb8dac2bedf5fafc498d98578dbd626918b8570928ba0d614a
|
7
|
+
data.tar.gz: 5d861333ea8b814b3c659a97801066768e5f0569ea38f973320276e64383aba185490570c26c27329be0e4864b2cfd518f8b226b33789e63ae089af4d2354826
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [0.
|
4
|
+
## [0.4.0] - 2020-01-19
|
5
|
+
### Added
|
6
|
+
- `SmartCore::Engine::Lock` - simple reentrant-based locking primitive;
|
7
|
+
|
8
|
+
## [0.3.0] - 2020-01-17
|
5
9
|
### Added
|
6
10
|
- Global error type `SmartCore::NameError` inherited from `::NameError`;
|
7
11
|
|
data/README.md
CHANGED
@@ -22,11 +22,26 @@ require 'smart_core'
|
|
22
22
|
|
23
23
|
## Technologies
|
24
24
|
|
25
|
-
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
- [Global set of error types](#global-set-of-error-types)
|
26
|
+
- [Simple reenternant lock](#simple-reenternant-lock)
|
27
|
+
|
28
|
+
---
|
29
|
+
|
30
|
+
### Global set of error types
|
31
|
+
|
32
|
+
- `SmartCore::Error` (inherited from `::StandardError`);
|
33
|
+
- `SmartCore::ArgumentError` (inherited from `::ArgumentError`);
|
34
|
+
- `SmartCore::FrozenError` (inherited from `::FrozenError`);
|
35
|
+
- `SmartCore::NameError` (inherited from `::NameError`);
|
36
|
+
|
37
|
+
---
|
38
|
+
|
39
|
+
### Simple reenternant lock
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
lock = SmartCore::Engine::Lock.new
|
43
|
+
lock.synchronize { your_code }
|
44
|
+
```
|
30
45
|
|
31
46
|
---
|
32
47
|
|
data/lib/smart_core/engine.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api public
|
4
|
+
# @since 0.4.0
|
5
|
+
class SmartCore::Engine::Lock
|
6
|
+
# @return [void]
|
7
|
+
#
|
8
|
+
# @api public
|
9
|
+
# @since 0.4.0
|
10
|
+
def initialize
|
11
|
+
@lock = Mutex.new
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param block [Block]
|
15
|
+
# @return [Any]
|
16
|
+
#
|
17
|
+
# @api public
|
18
|
+
# @since 0.4.0
|
19
|
+
def synchronize(&block)
|
20
|
+
@lock.owned? ? yield : @lock.synchronize(&block)
|
21
|
+
end
|
22
|
+
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.4.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-01-
|
11
|
+
date: 2020-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- bin/setup
|
120
120
|
- lib/smart_core.rb
|
121
121
|
- lib/smart_core/engine.rb
|
122
|
+
- lib/smart_core/engine/lock.rb
|
122
123
|
- lib/smart_core/engine/version.rb
|
123
124
|
- lib/smart_core/errors.rb
|
124
125
|
- smart_engine.gemspec
|