circular_queue 0.0.1 → 0.0.2

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.
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - rbx-2.0
6
+ - jruby
7
+ - ree
8
+ notifications:
9
+ disabled: true
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Circular Queue
2
+
3
+ Documentation, including example use, is covered in the [API
4
+ Docs](http://rdoc.info/github/alindeman/circular_queue/master/CircularQueue).
5
+
6
+ ## License
7
+
8
+ Copyright (c) 2011 Andy Lindeman
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a
11
+ copy of this software and associated documentation files (the
12
+ "Software"), to deal in the Software without restriction, including
13
+ without limitation the rights to use, copy, modify, merge, publish,
14
+ distribute, sublicense, and/or sell copies of the Software, and to
15
+ permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included
19
+ in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "circular_queue"
6
- s.version = "0.0.1"
6
+ s.version = "0.0.2"
7
7
  s.authors = ["Andy Lindeman"]
8
8
  s.email = ["alindeman@gmail.com"]
9
9
  s.homepage = ""
@@ -19,8 +19,8 @@ require "thread"
19
19
  # q << 3 # => [1, 2, 3]
20
20
  #
21
21
  # # Elements are replaced when the queue reaches capacity
22
- # q << 4 # => [4, 2, 3]
23
- # q << 5 # => [4, 5, 3]
22
+ # q << 4 # => [2, 3, 4]
23
+ # q << 5 # => [3, 4, 5]
24
24
  class CircularQueue
25
25
  # Returns the maximum number of elements that can be enqueued
26
26
  # @return [Integer]
@@ -32,7 +32,7 @@ class CircularQueue
32
32
  alias length size
33
33
 
34
34
  # Creates a new queue of the specified capacity
35
- # @param [Integer] the maximum capacity of the queue
35
+ # @param [Integer] capacity the maximum capacity of the queue
36
36
  def initialize(capacity)
37
37
  @capacity = capacity
38
38
  @data = Array.new(capacity)
@@ -44,7 +44,7 @@ class CircularQueue
44
44
  end
45
45
 
46
46
  # Adds an item to the queue
47
- # @param [Object] item to add
47
+ # @param [Object] item item to add
48
48
  def enq(item)
49
49
  @mutex.synchronize do
50
50
  enq_item(item)
@@ -55,7 +55,7 @@ class CircularQueue
55
55
  alias push enq
56
56
 
57
57
  # Adds an item to the queue, raising an error if the queue is full
58
- # @param [Object] item to add
58
+ # @param [Object] item item to add
59
59
  # @raise [ThreadError] queue is full
60
60
  def enq!(item)
61
61
  @mutex.synchronize do
@@ -68,8 +68,8 @@ class CircularQueue
68
68
  alias push! enq!
69
69
 
70
70
  # Removes an item from the queue
71
- # @param [Boolean] true to raise an error if the queue is empty; otherwise,
72
- # waits for an item to arrive from another thread
71
+ # @param [Boolean] non_block true to raise an error if the queue is empty;
72
+ # otherwise, waits for an item to arrive from another thread
73
73
  # @raise [ThreadError] non_block was true and the queue was empty
74
74
  def deq(non_block = false)
75
75
  @mutex.synchronize do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circular_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2156106760 !ruby/object:Gem::Requirement
16
+ requirement: &2168477680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.7.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2156106760
24
+ version_requirements: *2168477680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &2156106060 !ruby/object:Gem::Requirement
27
+ requirement: &2168476120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2156106060
35
+ version_requirements: *2168476120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &2156105200 !ruby/object:Gem::Requirement
38
+ requirement: &2168475140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2156105200
46
+ version_requirements: *2168475140
47
47
  description: A circular queue (also called a circular buffer or ring buffer) is useful
48
48
  when buffering data streams
49
49
  email:
@@ -53,7 +53,9 @@ extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
55
  - .gitignore
56
+ - .travis.yml
56
57
  - Gemfile
58
+ - README.md
57
59
  - Rakefile
58
60
  - circular_queue.gemspec
59
61
  - lib/circular_queue.rb
@@ -73,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
75
  version: '0'
74
76
  segments:
75
77
  - 0
76
- hash: -2375285051311577887
78
+ hash: 2997727403092005944
77
79
  required_rubygems_version: !ruby/object:Gem::Requirement
78
80
  none: false
79
81
  requirements:
@@ -82,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
84
  version: '0'
83
85
  segments:
84
86
  - 0
85
- hash: -2375285051311577887
87
+ hash: 2997727403092005944
86
88
  requirements: []
87
89
  rubyforge_project: circular_queue
88
90
  rubygems_version: 1.8.10