handling_queue 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d447fa9814068456364559b5259312d693b98bb409dfc1be0fb2b7767d313a01
4
- data.tar.gz: 34ef9a975afb0aab5f20d2616f4a87b34acebae1e64dcad4d677b77efd319ba1
3
+ metadata.gz: 48f9113a5c82e1dd6825800997ca032e9af2f32fcdc4b48c83cc0df32ebbf255
4
+ data.tar.gz: 18cf5dd4f6ffffd7c5ad4076cab41f6f214c1fd4b51980ea438cfd610b4af3f1
5
5
  SHA512:
6
- metadata.gz: acf5e6bbdc92c2e4cf740454da07710c130450e81488187578a63249725157623a24542d1056001fc2bfadb0c1684ee537a403129cec1dfc9c8f8d71391278fe
7
- data.tar.gz: 2bd825ed166e77ebaa65267f9d4d019198e44e2b6d9332b94bb0dd32432276bcfb9d780a5ecd7eb378b1609ac8cfe98081fe315854a8f275f2baee7b0dfd6015
6
+ metadata.gz: e571a07ea3fda2398a0da6fceacb4e0c9beff6f5e6044ca924d286e2100243eabbf1c99639356000799f74bd03c1fbac3216896e771342581a791b4ecce0ff87
7
+ data.tar.gz: 1c6a0d7b5e2dec78ac4e6efa0b272cb12e7c1bbd7fb4f880d3b323af647032363a9f19d7332c7259d09fed4907ccb7680538e554d5d582aa52f902afc7ba670e
data/.gitignore CHANGED
File without changes
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -1,41 +1,41 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- require:
4
- - rubocop-performance
5
-
6
- AllCops:
7
- DisplayCopNames: true
8
- DisplayStyleGuide: true
9
- ExtraDetails: false
10
- TargetRubyVersion: 2.6
11
- Exclude:
12
- - config/**/*
13
- - tmp/**/*
14
- - Capfile
15
- - Gemfile
16
- - Rakefile
17
-
18
- # Follow RubyGuides on this one
19
- Layout/EndOfLine:
20
- EnforcedStyle: lf
21
-
22
- # Just enough
23
- Layout/LineLength:
24
- Max: 100
25
-
26
- # Allow long testing methods
27
- Metrics/MethodLength:
28
- Exclude:
29
- - test/test_*.rb
30
-
31
- # Follow RubyGuides on this one
32
- Style/HashSyntax:
33
- EnforcedStyle: ruby19_no_mixed_keys
34
-
35
- # Prefer using Rubies methods
36
- Style/HashEachMethods:
37
- Enabled: true
38
- Style/HashTransformKeys:
39
- Enabled: true
40
- Style/HashTransformValues:
41
- Enabled: true
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+
6
+ AllCops:
7
+ DisplayCopNames: true
8
+ DisplayStyleGuide: true
9
+ ExtraDetails: false
10
+ TargetRubyVersion: 2.6
11
+ Exclude:
12
+ - config/**/*
13
+ - tmp/**/*
14
+ - Capfile
15
+ - Gemfile
16
+ - Rakefile
17
+
18
+ # Follow RubyGuides on this one
19
+ Layout/EndOfLine:
20
+ EnforcedStyle: lf
21
+
22
+ # Just enough
23
+ Layout/LineLength:
24
+ Max: 100
25
+
26
+ # Allow long testing methods
27
+ Metrics/MethodLength:
28
+ Exclude:
29
+ - test/test_*.rb
30
+
31
+ # Follow RubyGuides on this one
32
+ Style/HashSyntax:
33
+ EnforcedStyle: ruby19_no_mixed_keys
34
+
35
+ # Prefer using Rubies methods
36
+ Style/HashEachMethods:
37
+ Enabled: true
38
+ Style/HashTransformKeys:
39
+ Enabled: true
40
+ Style/HashTransformValues:
41
+ Enabled: true
@@ -1,7 +1,7 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2020-06-12 22:08:35 +0300 using RuboCop version 0.85.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-06-12 22:08:35 +0300 using RuboCop version 0.85.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
data/Gemfile CHANGED
@@ -1,9 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
- gem 'rake', '~> 12.0'
4
- gem 'minitest', '~> 5.0'
5
+ # Specify your gem's dependencies in vk_music.gemspec
6
+ gemspec
7
+
8
+ group :test, :development do
9
+ # Debugging console
10
+ gem 'pry'
11
+
12
+ # Another debugging console
13
+ gem 'byebug'
14
+
15
+ # The thing, forcing you to write good code
16
+ gem 'rubocop', require: false
17
+ gem 'rubocop-performance', require: false
18
+
19
+ # Rake tasks
20
+ gem 'rake', require: false
21
+
22
+ # Testing
23
+ gem 'rspec', require: false
5
24
 
6
- gem 'rubocop', '~> 0.85.0'
7
- gem 'rubocop-performance', require: false
25
+ # Docs
26
+ gem 'yard', require: false
8
27
 
9
- gem 'pry', '~> 0.13.1'
28
+ # Test coverage
29
+ gem 'simplecov', require: false, group: :test
30
+ end
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -1,48 +1,18 @@
1
- require 'bundler/gem_tasks'
1
+ # frozen_string_literal: true
2
2
 
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
4
- RuboCop::RakeTask.new(:rubocop) {}
6
+ require 'yard'
5
7
 
6
- require 'rake/testtask'
7
- Rake::TestTask.new do |t|
8
- t.libs << 'test'
9
- t.test_files = FileList['test/test*.rb']
10
- t.verbose = true
11
- end
8
+ RSpec::Core::RakeTask.new(:spec)
12
9
 
13
- namespace 'rubocop' do
14
- desc 'Generate rubocop TODO file.'
15
- task 'todo' do
16
- puts `rubocop --auto-gen-config`
17
- end
18
- end
10
+ RuboCop::RakeTask.new
19
11
 
20
- namespace 'yardoc' do
21
- desc 'Generate documentation'
22
- task 'generate' do
23
- puts `yardoc lib/*`
24
- end
25
-
26
- desc 'List undocumented elements'
27
- task 'undoc' do
28
- puts `yardoc stats --list-undoc lib/*`
29
- end
12
+ YARD::Rake::YardocTask.new do |t|
13
+ t.files = ['lib/**/*.rb']
14
+ t.options = ['--any', '--extra', '--opts']
15
+ t.stats_options = ['--list-undoc']
30
16
  end
31
17
 
32
- namespace 'eol' do
33
- desc 'Replace CRLF with LF.'
34
- task :dos2unix, [:pattern] do |_t, args|
35
- path_list = Dir.glob(args.pattern || '**/*.{rb,rake}', File::FNM_EXTGLOB)
36
- counter = 0
37
- path_list.each do |path|
38
- next unless File.file?(path)
39
-
40
- counter += 1
41
- puts "Handling `#{path}`..."
42
- content = File.read(path, mode: 'rb')
43
- content.gsub!(/\r\n/, "\n")
44
- File.write(path, content, mode: 'wb')
45
- end
46
- puts "Handled #{counter} files."
47
- end
48
- end
18
+ task default: %i[rubocop spec yard]
File without changes
File without changes
@@ -31,7 +31,7 @@ class HandlingQueue
31
31
  request = Request.new(obj)
32
32
  @mutex.synchronize do
33
33
  @requests_queue.push(request)
34
- @cv.wait(@mutex) while request.re.nil?
34
+ @cv.wait(@mutex) until request.re?
35
35
  request.re
36
36
  end
37
37
  end
@@ -7,12 +7,20 @@ class HandlingQueue
7
7
  attr_accessor :obj
8
8
 
9
9
  # @return [void] handled object or +nil+ if not handled yet.
10
- attr_accessor :re
10
+ def re
11
+ return @re if re?
12
+ end
13
+
14
+ attr_writer :re
15
+
16
+ # @return [Boolean] whether handled
17
+ def re?
18
+ defined? @re
19
+ end
11
20
 
12
21
  # @param obj [void] object to be handled.
13
22
  def initialize(obj)
14
23
  @obj = obj
15
- @re = nil
16
24
  end
17
25
  end
18
26
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  class HandlingQueue
4
4
  # Library version.
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handling_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fizvlad
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-13 00:00:00.000000000 Z
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -18,9 +18,9 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - ".gitignore"
21
+ - ".rspec"
21
22
  - ".rubocop.yml"
22
23
  - ".rubocop_todo.yml"
23
- - ".travis.yml"
24
24
  - Gemfile
25
25
  - LICENSE.txt
26
26
  - README.md
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubygems_version: 3.1.0.pre2
54
+ rubygems_version: 3.1.2
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: General purpose text bots
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.5
6
- before_install: gem install bundler -v 2.1.4