syncem 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5761e6992463f8579483a2b08eceec8a322aaac1e7474a77b161a47919655311
4
- data.tar.gz: 825171250d56b5e20e4b139058b4cfddf44edc8882dcced73ac71f2fe72994c8
3
+ metadata.gz: d6cc69151ea6e9cedcc556cc93381baff79fa64fb2678fa9ec11ea9be954a2f4
4
+ data.tar.gz: ac322a4adb09be7f4dd7d9c4d2eaf19997d80c79ef0b2e37cc3a90e248bd62ea
5
5
  SHA512:
6
- metadata.gz: 41b7696bbb9cd74832e1e6c0cc6255ef3d3c0d815d3c177aa51cbfb449f1d3985ca25065c0ab36aea39d9e4e25b5d078d813a7a0bbedea4b58ac0a6c09217679
7
- data.tar.gz: adce504a8e497df4b2bbb372a5c9dc19e64003c81d523778d4b459e6cb16b978e59cb708ce6a7bc943213bdfdb5888c30df72f197772122ec9236b29ff14d509
6
+ metadata.gz: e041ddf121dfa41dc9392c5b0f6bb0a084e99c0d0fd03bd941587c7fec27a5545400feeb7ea4767270b319ce8acf744b4c94389db25f6b8843a073eda9841f46
7
+ data.tar.gz: 6dcc736e27e91851de2f331c5d14d6c4fde92f7c8e156035c0fbb469f48a3ba9037ebb3f065876bf120a59166e9dddb22e13130a2574d3035c9dea373cdb9169
@@ -1,11 +1,11 @@
1
1
  assets:
2
- rubygems.yml: zerocracy/home#assets/rubygems.yml
2
+ rubygems.yml: yegor256/home#assets/rubygems.yml
3
3
  install: |-
4
4
  export GEM_HOME=~/.ruby
5
5
  export GEM_PATH=$GEM_HOME:$GEM_PATH
6
+ bundle install
6
7
  release:
7
8
  script: |-
8
- bundle install
9
9
  bundle exec rake
10
10
  rm -rf *.gem
11
11
  sed -i "s/0\.0\.0/${tag}/g" syncem.gemspec
@@ -14,13 +14,11 @@ release:
14
14
  gem build syncem.gemspec
15
15
  chmod 0600 ../rubygems.yml
16
16
  gem push *.gem --config-file ../rubygems.yml
17
- commanders:
18
- - yegor256
19
- architect:
20
- - yegor256
21
17
  merge:
22
- commanders: []
23
18
  script: |-
24
19
  bundle install
25
- rake
26
- deploy: {}
20
+ bundle exec rake
21
+ deploy:
22
+ script: |-
23
+ echo 'Nothing to deploy'
24
+ exit -1
@@ -8,5 +8,5 @@ install:
8
8
  - bundle install
9
9
  script:
10
10
  - set -e
11
- - rake
11
+ - bundle exec rake
12
12
 
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Yegor Bugayenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,19 +1,25 @@
1
- [![EO principles respected here](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org)
1
+ <img src="/logo.svg" width="64px" height="64px"/>
2
+
3
+ [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
2
4
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/syncem)](http://www.rultor.com/p/yegor256/syncem)
3
- [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
5
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
4
6
 
5
7
  [![Build Status](https://travis-ci.org/yegor256/syncem.svg)](https://travis-ci.org/yegor256/syncem)
6
- [![Build status](https://ci.appveyor.com/api/projects/status/po1mn8ca96jk0llr?svg=true)](https://ci.appveyor.com/project/yegor256/syncem)
8
+ [![Build status](https://ci.appveyor.com/api/projects/status/m7hisfd90tpc198s?svg=true)](https://ci.appveyor.com/project/yegor256/syncem)
7
9
  [![Gem Version](https://badge.fury.io/rb/syncem.svg)](http://badge.fury.io/rb/syncem)
8
10
  [![Maintainability](https://api.codeclimate.com/v1/badges/5528e182bb5e4a2ecc1f/maintainability)](https://codeclimate.com/github/yegor256/syncem/maintainability)
9
11
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/syncem/master/frames)
10
12
 
13
+ [![Hits-of-Code](https://hitsofcode.com/github/yegor256/syncem)](https://hitsofcode.com/view/github/yegor256/syncem)
14
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/syncem/blob/master/LICENSE.txt)
15
+
11
16
  Sometimes you have an object that is not thread-safe,
12
17
  but you need to make sure each of its methods is thread-safe, because they
13
18
  deal with some resources, like files or databases and you want them to
14
19
  manage those resources sequentially. This small gem will help you achieve
15
20
  exactly that without any re-design of the objects you already have. Just
16
- decorate them with `SyncEm` decorator and that is it.
21
+ decorate them with `SyncEm` [thread-safe decorator](https://www.yegor256.com/2017/01/17/synchronized-decorators.html)
22
+ and that is it.
17
23
 
18
24
  First, install it:
19
25
 
@@ -30,7 +36,7 @@ obj = SyncEm.new(obj)
30
36
 
31
37
  That's it.
32
38
 
33
- # How to contribute
39
+ ## How to contribute
34
40
 
35
41
  Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
36
42
  Make sure you build is green before you contribute
@@ -39,31 +45,7 @@ your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2
39
45
 
40
46
  ```
41
47
  $ bundle update
42
- $ rake
48
+ $ bundle exec rake
43
49
  ```
44
50
 
45
51
  If it's clean and you don't see any error messages, submit your pull request.
46
-
47
- # License
48
-
49
- (The MIT License)
50
-
51
- Copyright (c) 2018-2019 Yegor Bugayenko
52
-
53
- Permission is hereby granted, free of charge, to any person obtaining a copy
54
- of this software and associated documentation files (the 'Software'), to deal
55
- in the Software without restriction, including without limitation the rights
56
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
57
- copies of the Software, and to permit persons to whom the Software is
58
- furnished to do so, subject to the following conditions:
59
-
60
- The above copyright notice and this permission notice shall be included in all
61
- copies or substantial portions of the Software.
62
-
63
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
69
- SOFTWARE.
@@ -32,6 +32,8 @@
32
32
  # Copyright:: Copyright (c) 2018-2019 Yegor Bugayenko
33
33
  # License:: MIT
34
34
  class SyncEm
35
+ undef_method :send
36
+
35
37
  def initialize(origin)
36
38
  @origin = origin
37
39
  @mutex = Mutex.new
@@ -40,7 +42,7 @@ class SyncEm
40
42
  def method_missing(*args)
41
43
  @mutex.synchronize do
42
44
  if @origin.respond_to?(args[0])
43
- @origin.send(*args) do |*a|
45
+ @origin.__send__(*args) do |*a|
44
46
  yield(*a) if block_given?
45
47
  end
46
48
  else
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="314px" height="314px" viewBox="0 0 314 314" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
4
+ <title>Group 2</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs></defs>
7
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+ <g id="Group-2">
9
+ <g id="Group">
10
+ <circle id="Oval" fill="#053C5E" cx="157" cy="157" r="157"></circle>
11
+ <rect id="Rectangle" fill="#2B2B2B" x="0" y="234" width="237" height="68"></rect>
12
+ <text id="syncem" font-family="CourierNewPS-BoldMT, Courier New" font-size="50" font-weight="bold" fill="#FFFFFF">
13
+ <tspan x="28" y="282">syncem</tspan>
14
+ </text>
15
+ <path d="M135.676765,111.215287 C135.211714,113.540467 132.770932,120.688823 130.252813,127.100603 C127.734621,133.512383 125.2898,140.431445 124.819828,142.476214 C123.6868,147.405663 121.517836,147.185477 119.69487,141.95608 C116.899865,133.938362 105.171362,111.043501 103.859129,111.043501 C100.420089,111.043501 101.508757,114.986149 109.1771,130.30227 C113.739327,139.414532 118.032086,147.448041 118.716515,148.15443 C120.694817,150.196115 120.172626,154.319657 117.358599,158.877992 C113.567467,165.019055 107.570942,183.721189 108.054206,187.896804 C108.804956,194.383204 112.436054,192.210274 113.355359,184.724515 C114.48376,175.535577 120.945556,159.641154 124.897459,156.333653 C127.109021,154.482778 128.268636,151.905536 128.573284,148.163978 C128.818001,145.157747 131.906711,135.560972 135.437115,126.837819 C138.96752,118.114666 141.511492,110.079835 141.090434,108.982574 C139.755727,105.504315 136.554941,106.824333 135.676765,111.215287 M174.714659,126.841564 C169.37392,129.699438 169.197653,130.049915 167.452978,141.283475 C165.577352,153.360398 165.225112,168.513913 166.548289,180.203784 L167.566817,189.202501 L161.346213,191.9541 C154.601949,194.937416 150.91195,200.302465 153.156708,203.861146 C155.104824,206.949562 157.09025,206.70198 157.571826,203.310532 C158.083734,199.706169 166.097413,193.204052 170.29418,192.987978 C172.116999,192.894116 173.522874,191.717021 173.97823,189.903529 C174.383277,188.290613 177.740353,184.944554 181.438431,182.467858 C188.546172,177.707551 194.317883,170.450278 194.317883,166.273341 C194.317883,162.684548 189.493165,158.361603 185.487795,158.361603 C180.701636,158.361603 180.027195,155.239403 183.731222,150.229385 C188.308065,144.038966 188.284856,130.867646 183.690534,127.147387 C179.896537,124.075276 179.885006,124.074836 174.714659,126.841564 M182.67318,134.240439 C184.752542,140.153164 174.808961,161.185104 171.588639,157.68562 C169.868715,155.81653 172.863122,135.012708 175.266374,132.134564 C177.872553,129.013319 181.163896,129.949075 182.67318,134.240439 M184.854262,162.269586 C190.589839,163.855621 189.673839,167.881335 181.645765,176.371155 C177.281618,180.986262 173.904933,183.573859 173.371946,182.711474 C172.876636,181.91012 172.127869,176.711937 171.707987,171.159972 L170.944531,161.065463 L176.209475,161.200234 C179.105172,161.274339 182.995308,161.755548 184.854262,162.269586 M132.642184,172.492256 C131.593837,175.224098 133.152917,177.288844 136.264027,177.288844 C139.014965,177.288844 139.431396,176.221769 138.067531,172.667568 C137.039234,169.987871 133.645289,169.878218 132.642184,172.492256 M203.781503,185.840798 C203.781503,187.657595 209.264724,193.512152 210.966361,193.512152 C212.534035,193.512152 211.991059,187.391138 210.270768,185.670847 C208.092403,183.492409 203.781503,183.605293 203.781503,185.840798" id="Fill-6" fill="#427B8A" fill-rule="nonzero"></path>
16
+ </g>
17
+ </g>
18
+ </g>
19
+ </svg>
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.rubygems_version = '2.3.3'
32
32
  s.required_ruby_version = '>=2.3'
33
33
  s.name = 'syncem'
34
- s.version = '0.1.1'
34
+ s.version = '0.1.2'
35
35
  s.license = 'MIT'
36
36
  s.summary = 'Thread-safe decorator of Ruby objects'
37
37
  s.description = 'Sometimes you have an object that is not thread-safe,
@@ -71,6 +71,15 @@ class SyncEmTest < Minitest::Test
71
71
  end
72
72
  end
73
73
 
74
+ def test_works_with_send_method
75
+ obj = Object.new
76
+ def obj.send(first, second)
77
+ first + second
78
+ end
79
+ synced = SyncEm.new(obj)
80
+ assert_equal(5, synced.send(2, 3))
81
+ end
82
+
74
83
  def test_works_with_block
75
84
  Dir.mktmpdir do |dir|
76
85
  path = File.join(dir, 'f.txt')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syncem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-13 00:00:00.000000000 Z
11
+ date: 2019-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -114,10 +114,12 @@ files:
114
114
  - ".rultor.yml"
115
115
  - ".travis.yml"
116
116
  - Gemfile
117
+ - LICENSE.txt
117
118
  - README.md
118
119
  - Rakefile
119
120
  - appveyor.yml
120
121
  - lib/syncem.rb
122
+ - logo.svg
121
123
  - syncem.gemspec
122
124
  - test/test_syncem.rb
123
125
  homepage: http://github.com/yegor256/syncem