revolver 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README.markdown +1 -1
  3. data/lib/revolver.rb +7 -3
  4. metadata +9 -12
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20608d90daa38df7922b570e26739077bde71d39
4
+ data.tar.gz: 3b7f8f7b6cb8c79bf35ff8dc0fc7f6895fbce756
5
+ SHA512:
6
+ metadata.gz: a28987ab863c417f2c1a06a1797417de0ab656c0ddacb289792a35a896d97f775801b5a8d7d1310639fe0dc57aa5ca8d5e589abeb3d7d322bbfd631f7161d108
7
+ data.tar.gz: 8eae8849882fc43f186b01c45526621de4a3bd65c3e53d163868856d5472ea0967f171d03e5786b3de3a14f745df8cd7a9450694344a14c8ef8eb0c668c1f104
@@ -18,7 +18,7 @@ Create a `Revolver` with unique elements:
18
18
 
19
19
  Alternatively, you can create a `Revolver` from an existing array:
20
20
 
21
- Revolver.from_array([*1..3], 3)
21
+ Revolver.from_array([*1..3])
22
22
  #=> #<Revolver: [1, 2, 3]>
23
23
 
24
24
  Or from a list of elements:
@@ -1,6 +1,6 @@
1
1
  class Revolver
2
- def self.from_array(array, unique = false)
3
- rev = Revolver.new(array.size, unique)
2
+ def self.from_array(array, unique: false)
3
+ rev = Revolver.new(array.size, unique: unique)
4
4
  array.inject(rev) { |r, e| r << e }
5
5
  end
6
6
 
@@ -8,7 +8,7 @@ class Revolver
8
8
  from_array(array)
9
9
  end
10
10
 
11
- def initialize(size, unique = false)
11
+ def initialize(size, unique: false)
12
12
  @array = []
13
13
  @size = size
14
14
  @unique = unique
@@ -33,6 +33,10 @@ class Revolver
33
33
  @array.size
34
34
  end
35
35
 
36
+ def unique?
37
+ !!@unique
38
+ end
39
+
36
40
  def to_a
37
41
  @array.dup
38
42
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revolver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael Kohl
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-11 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description:
15
14
  email: citizen428@gmail.com
@@ -17,32 +16,30 @@ executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
19
+ - "./LICENSE"
20
+ - "./README.markdown"
20
21
  - lib/revolver.rb
21
- - ./LICENSE
22
- - ./README.markdown
23
22
  homepage: http://citizen428.github.com/revolver/
24
23
  licenses: []
24
+ metadata: {}
25
25
  post_install_message:
26
26
  rdoc_options: []
27
27
  require_paths:
28
28
  - lib
29
29
  required_ruby_version: !ruby/object:Gem::Requirement
30
- none: false
31
30
  requirements:
32
- - - ! '>='
31
+ - - ">="
33
32
  - !ruby/object:Gem::Version
34
33
  version: '0'
35
34
  required_rubygems_version: !ruby/object:Gem::Requirement
36
- none: false
37
35
  requirements:
38
- - - ! '>='
36
+ - - ">="
39
37
  - !ruby/object:Gem::Version
40
38
  version: '0'
41
39
  requirements: []
42
40
  rubyforge_project:
43
- rubygems_version: 1.8.11
41
+ rubygems_version: 2.2.2
44
42
  signing_key:
45
- specification_version: 3
43
+ specification_version: 4
46
44
  summary: A fixed-size LIFO data structure
47
45
  test_files: []
48
- has_rdoc: false