qfill 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/style.yml +37 -0
  4. data/.github/workflows/test.yml +55 -0
  5. data/.rspec +3 -2
  6. data/.rubocop.yml +26 -0
  7. data/.rubocop_todo.yml +163 -0
  8. data/.simplecov +6 -0
  9. data/CODE_OF_CONDUCT.md +133 -0
  10. data/Gemfile +33 -0
  11. data/Guardfile +12 -0
  12. data/{LICENSE.txt → LICENSE} +1 -1
  13. data/README.md +2 -2
  14. data/Rakefile +24 -1
  15. data/lib/qfill.rb +13 -10
  16. data/lib/qfill/errors/invalid_index.rb +8 -0
  17. data/lib/qfill/filter.rb +5 -3
  18. data/lib/qfill/list.rb +4 -2
  19. data/lib/qfill/list_set.rb +13 -9
  20. data/lib/qfill/manager.rb +78 -124
  21. data/lib/qfill/origin.rb +4 -3
  22. data/lib/qfill/popper.rb +30 -25
  23. data/lib/qfill/pusher.rb +33 -22
  24. data/lib/qfill/result.rb +63 -42
  25. data/lib/qfill/strategy.rb +13 -0
  26. data/lib/qfill/strategy/base.rb +65 -0
  27. data/lib/qfill/strategy/drain_to_empty.rb +73 -0
  28. data/lib/qfill/strategy/drain_to_limit.rb +46 -0
  29. data/lib/qfill/strategy/sample.rb +42 -0
  30. data/lib/qfill/strategy/time_slice.rb +106 -0
  31. data/lib/qfill/version.rb +3 -1
  32. data/maintenance-branch +1 -0
  33. data/qfill.gemspec +15 -13
  34. data/spec/qfill/filter_spec.rb +35 -26
  35. data/spec/qfill/list_set_spec.rb +28 -23
  36. data/spec/qfill/list_spec.rb +35 -27
  37. data/spec/qfill/manager_spec.rb +670 -434
  38. data/spec/qfill/origin_spec.rb +45 -35
  39. data/spec/qfill/popper_spec.rb +36 -30
  40. data/spec/qfill/pusher_spec.rb +32 -26
  41. data/spec/qfill/result_spec.rb +49 -38
  42. data/spec/qfill_spec.rb +6 -5
  43. data/spec/spec_helper.rb +11 -38
  44. data/spec/support/helper.rb +13 -0
  45. data/spec/support/random_object.rb +30 -0
  46. metadata +52 -23
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RandomObject
4
+ attr_accessor :rating, :queue
5
+
6
+ def initialize(options = {})
7
+ @rating = options[:rating] || RandomObject.random_rating
8
+ @queue = RandomObject.list_designation(rating)
9
+ end
10
+
11
+ def self.random_rating
12
+ rand(101) # 0 - 100
13
+ end
14
+
15
+ def self.list_designation(rating)
16
+ if rating == 0
17
+ 'none'
18
+ elsif rating < 34
19
+ 'low'
20
+ elsif rating < 67
21
+ 'medium'
22
+ else
23
+ 'high'
24
+ end
25
+ end
26
+
27
+ def to_s
28
+ "RO:#{rating}:#{queue}"
29
+ end
30
+ end
metadata CHANGED
@@ -1,32 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qfill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Boling
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-06 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13'
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: rspec
16
29
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
30
  requirements:
19
- - - '>='
31
+ - - "~>"
20
32
  - !ruby/object:Gem::Version
21
- version: '0'
33
+ version: '3'
22
34
  type: :development
23
35
  prerelease: false
24
36
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
37
  requirements:
27
- - - '>='
38
+ - - "~>"
28
39
  - !ruby/object:Gem::Version
29
- version: '0'
40
+ version: '3'
30
41
  description: Advanced Queue Transformation
31
42
  email:
32
43
  - peter.boling@gmail.com
@@ -34,13 +45,22 @@ executables: []
34
45
  extensions: []
35
46
  extra_rdoc_files: []
36
47
  files:
37
- - .gitignore
38
- - .rspec
48
+ - ".github/dependabot.yml"
49
+ - ".github/workflows/style.yml"
50
+ - ".github/workflows/test.yml"
51
+ - ".gitignore"
52
+ - ".rspec"
53
+ - ".rubocop.yml"
54
+ - ".rubocop_todo.yml"
55
+ - ".simplecov"
56
+ - CODE_OF_CONDUCT.md
39
57
  - Gemfile
40
- - LICENSE.txt
58
+ - Guardfile
59
+ - LICENSE
41
60
  - README.md
42
61
  - Rakefile
43
62
  - lib/qfill.rb
63
+ - lib/qfill/errors/invalid_index.rb
44
64
  - lib/qfill/filter.rb
45
65
  - lib/qfill/list.rb
46
66
  - lib/qfill/list_set.rb
@@ -49,7 +69,14 @@ files:
49
69
  - lib/qfill/popper.rb
50
70
  - lib/qfill/pusher.rb
51
71
  - lib/qfill/result.rb
72
+ - lib/qfill/strategy.rb
73
+ - lib/qfill/strategy/base.rb
74
+ - lib/qfill/strategy/drain_to_empty.rb
75
+ - lib/qfill/strategy/drain_to_limit.rb
76
+ - lib/qfill/strategy/sample.rb
77
+ - lib/qfill/strategy/time_slice.rb
52
78
  - lib/qfill/version.rb
79
+ - maintenance-branch
53
80
  - qfill.gemspec
54
81
  - spec/qfill/filter_spec.rb
55
82
  - spec/qfill/list_set_spec.rb
@@ -61,29 +88,29 @@ files:
61
88
  - spec/qfill/result_spec.rb
62
89
  - spec/qfill_spec.rb
63
90
  - spec/spec_helper.rb
64
- homepage: ''
91
+ - spec/support/helper.rb
92
+ - spec/support/random_object.rb
93
+ homepage: https://github.com/pboling/qfill
65
94
  licenses: []
66
- post_install_message:
95
+ metadata: {}
96
+ post_install_message:
67
97
  rdoc_options: []
68
98
  require_paths:
69
99
  - lib
70
100
  required_ruby_version: !ruby/object:Gem::Requirement
71
- none: false
72
101
  requirements:
73
- - - '>='
102
+ - - ">="
74
103
  - !ruby/object:Gem::Version
75
104
  version: '0'
76
105
  required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
106
  requirements:
79
- - - '>='
107
+ - - ">="
80
108
  - !ruby/object:Gem::Version
81
109
  version: '0'
82
110
  requirements: []
83
- rubyforge_project:
84
- rubygems_version: 1.8.25
85
- signing_key:
86
- specification_version: 3
111
+ rubygems_version: 3.2.9
112
+ signing_key:
113
+ specification_version: 4
87
114
  summary: 'You have a set of arrays that need to be turned into a different set of
88
115
  arrays according to a potentially non-uniform set of rules. Now you can easily
89
116
  turn this: source_a # => [1,2,3,4] source_b # => [5,6,7,8,9] into this: result_a
@@ -100,3 +127,5 @@ test_files:
100
127
  - spec/qfill/result_spec.rb
101
128
  - spec/qfill_spec.rb
102
129
  - spec/spec_helper.rb
130
+ - spec/support/helper.rb
131
+ - spec/support/random_object.rb