conv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,13 @@
1
1
  = conv
2
2
 
3
- This is primarily a test push to gemcutter.
3
+ This was primarily a test push to gemcutter.
4
+
5
+ conv contains convenience methods that I frequently add to projects.
6
+
7
+ This version contains
8
+ the Loop class (via the Loopable Module).
9
+ Array.rand method
10
+
4
11
 
5
12
  == Note on Patches/Pull Requests
6
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{conv}
8
- s.version = "0.0.1"
8
+ s.version = File.read('VERSION')
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["codesponge"]
12
12
  s.date = %q{2010-01-26}
13
- s.description = %q{Mainly testing gemcutter deployment}
13
+ s.description = %q{handy methods}
14
14
  s.email = %q{billy@codesponge.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -26,7 +26,8 @@ Gem::Specification.new do |s|
26
26
  "conv.gemspec",
27
27
  "lib/conv.rb",
28
28
  "test/helper.rb",
29
- "test/test_conv.rb"
29
+ "test/test_array.rb",
30
+ "test/test_loop.rb"
30
31
  ]
31
32
  s.homepage = %q{http://github.com/codesponge/conv}
32
33
  s.rdoc_options = ["--charset=UTF-8"]
@@ -35,7 +36,8 @@ Gem::Specification.new do |s|
35
36
  s.summary = %q{ctest conv methods}
36
37
  s.test_files = [
37
38
  "test/helper.rb",
38
- "test/test_conv.rb"
39
+ "test/test_array.rb",
40
+ "test/test_loop.rb"
39
41
  ]
40
42
 
41
43
  if s.respond_to? :specification_version then
@@ -1,5 +1,2 @@
1
- class Array
2
- def rand
3
- self[ (Kernel::rand(self.size)) ]
4
- end
5
- end
1
+ require 'array'
2
+ require 'loop'
File without changes
@@ -0,0 +1,45 @@
1
+ require 'helper'
2
+
3
+ class TestConv < Test::Unit::TestCase
4
+ context "A Loop instance " do
5
+
6
+ setup do
7
+ @al = Loop.new([1,2,3,4,5,"hog","cannon","globe"])
8
+ end
9
+
10
+ should "be class loop" do
11
+ assert_equal @al.class, Loop
12
+ end
13
+
14
+ @expected_methods = %w[next prev forward backward current set_position position]
15
+ @expected_methods.each do |m|
16
+ should "respond to #{m}" do
17
+ assert_respond_to(@al, m)
18
+ end
19
+
20
+ end
21
+
22
+ should "go next and prev" do
23
+ c = @al.current
24
+ n = @al.next
25
+ b = @al.prev
26
+ assert_equal c,b
27
+ end
28
+
29
+ should "loop from end of array back to begining" do
30
+ @al.set_position(@al.size - 1) # last element
31
+ #the "next" element after the last should be the first
32
+ #element
33
+ assert_equal @al.next, @al.first
34
+ end
35
+
36
+ should "loop from begining to end when stepping backwards" do
37
+ @al.set_position(0) #first element
38
+ #the "prev" element should be the same as the last element
39
+ assert_equal @al.prev,@al.last
40
+ end
41
+
42
+
43
+ end
44
+
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - codesponge
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
- description: Mainly testing gemcutter deployment
25
+ description: handy methods
26
26
  email: billy@codesponge.com
27
27
  executables: []
28
28
 
@@ -41,7 +41,8 @@ files:
41
41
  - conv.gemspec
42
42
  - lib/conv.rb
43
43
  - test/helper.rb
44
- - test/test_conv.rb
44
+ - test/test_array.rb
45
+ - test/test_loop.rb
45
46
  has_rdoc: true
46
47
  homepage: http://github.com/codesponge/conv
47
48
  licenses: []
@@ -72,4 +73,5 @@ specification_version: 3
72
73
  summary: ctest conv methods
73
74
  test_files:
74
75
  - test/helper.rb
75
- - test/test_conv.rb
76
+ - test/test_array.rb
77
+ - test/test_loop.rb