backports 2.3.0 → 2.4.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.
Files changed (55) hide show
  1. data/.irbrc +1 -0
  2. data/README.rdoc +55 -3
  3. data/Rakefile +1 -0
  4. data/VERSION.yml +1 -1
  5. data/backports.gemspec +99 -118
  6. data/lib/backports/1.8.7/string.rb +1 -1
  7. data/lib/backports/1.9.1/array.rb +1 -2
  8. data/lib/backports/1.9.1/file.rb +20 -0
  9. data/lib/backports/1.9.1/float.rb +19 -0
  10. data/lib/backports/1.9.1/hash.rb +20 -3
  11. data/lib/backports/1.9.1/integer.rb +19 -0
  12. data/lib/backports/1.9.1/io.rb +18 -3
  13. data/lib/backports/1.9.1/numeric.rb +9 -0
  14. data/lib/backports/1.9.1/regexp.rb +1 -6
  15. data/lib/backports/1.9.1/stdlib/prime.rb +495 -0
  16. data/lib/backports/1.9.1/stdlib.rb +1 -0
  17. data/lib/backports/1.9.1/string.rb +2 -7
  18. data/lib/backports/1.9.2/array.rb +3 -4
  19. data/lib/backports/1.9.2/complex.rb +6 -0
  20. data/lib/backports/1.9.2/stdlib/matrix/eigenvalue_decomposition.rb +886 -0
  21. data/lib/backports/1.9.2/stdlib/matrix/lup_decomposition.rb +218 -0
  22. data/lib/backports/1.9.2/stdlib/matrix.rb +1872 -0
  23. data/lib/backports/1.9.2/stdlib/set.rb +13 -0
  24. data/lib/backports/1.9.2/stdlib.rb +1 -0
  25. data/lib/backports/1.9.3/io.rb +12 -0
  26. data/lib/backports/1.9.3.rb +5 -0
  27. data/lib/backports/1.9.rb +1 -1
  28. data/lib/backports/basic_object.rb +3 -2
  29. data/lib/backports/force/array_map.rb +1 -0
  30. data/lib/backports/force/enumerable_map.rb +3 -0
  31. data/lib/backports/force/hash_select.rb +9 -0
  32. data/lib/backports/force/string_length.rb +10 -0
  33. data/lib/backports/force/string_size.rb +1 -0
  34. data/lib/backports/tools.rb +137 -1
  35. data/test/README +13 -0
  36. metadata +25 -42
  37. data/.gitignore +0 -7
  38. data/test/_README +0 -1
  39. data/test/array_test.rb +0 -82
  40. data/test/basic_object_test.rb +0 -70
  41. data/test/binding_test.rb +0 -20
  42. data/test/enumerable_test.rb +0 -244
  43. data/test/enumerator_test.rb +0 -45
  44. data/test/hash_test.rb +0 -26
  45. data/test/kernel_test.rb +0 -31
  46. data/test/math_test.rb +0 -59
  47. data/test/method_missing_test.rb +0 -37
  48. data/test/method_test.rb +0 -73
  49. data/test/module_test.rb +0 -20
  50. data/test/object_test.rb +0 -35
  51. data/test/proc_test.rb +0 -116
  52. data/test/regexp_test.rb +0 -14
  53. data/test/string_test.rb +0 -74
  54. data/test/symbol_test.rb +0 -23
  55. data/test/test_helper.rb +0 -8
data/test/regexp_test.rb DELETED
@@ -1,14 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RegexpTest < Test::Unit::TestCase
4
- context "Regexp" do
5
- context ".union" do
6
- should "conform to doc" do
7
- assert_equal /cat/ , Regexp.union("cat")
8
- assert_equal /cat|dog/ , Regexp.union("cat", "dog")
9
- assert_equal /cat|dog/ , Regexp.union(%w{ cat dog })
10
- assert_equal /cat|(?i-mx:dog)/, Regexp.union("cat", /dog/i)
11
- end
12
- end
13
- end
14
- end
data/test/string_test.rb DELETED
@@ -1,74 +0,0 @@
1
- # encoding: utf-8
2
- $KCODE = 'u' if RUBY_VERSION < '1.9'
3
- require 'test_helper'
4
-
5
- class StringTest < Test::Unit::TestCase
6
- context "String" do
7
- context "#ascii_only?" do
8
- should "conform to doc" do
9
- assert_equal true, "dog".ascii_only?
10
- assert_equal false, "δog".ascii_only?
11
- assert_equal true, "\x00 to \x7f".ascii_only?
12
- end
13
- end
14
-
15
- context "#chars" do
16
- should "conform to doc" do
17
- assert_equal ["d", "o", "g"], "dog".chars.to_a
18
- assert_equal ["δ", "o", "g"], "δog".chars.to_a
19
- result = []
20
- "δog".chars.each {|b| result << b }
21
- assert_equal ["δ", "o", "g"], result
22
- end
23
- end
24
-
25
- context "#chr" do
26
- should "conform to doc" do
27
- assert_equal "d", "dog".chr
28
- assert_equal "δ", "δog".chr
29
- end
30
- end
31
-
32
- context "#codepoints" do
33
- should "conform to doc" do
34
- assert_equal [100, 111, 103], "dog".codepoints.to_a
35
- assert_equal [948, 111, 103], "δog".codepoints.to_a # Note, there is an error in Pragmatics' book
36
- result = []
37
- assert_equal "δog", "δog".codepoints.each {|b| result << b }
38
- assert_equal [948, 111, 103], result
39
- end
40
- end
41
-
42
- context "#start_with" do
43
- should "conform to doc" do
44
- assert "Apache".start_with?("Apa")
45
- assert "ruby code".start_with?("python", "perl", "ruby")
46
- assert !"hello world".start_with?("world")
47
- end
48
- end
49
-
50
- context "#end_with" do
51
- should "conform to doc" do
52
- assert "Apache".end_with?("ache")
53
- assert "ruby code".end_with?("python", "perl", "code")
54
- assert !"hello world".end_with?("hello")
55
- end
56
- end
57
-
58
- context "#partition" do
59
- should "conform to doc" do
60
- assert_equal ["THX", "11", "38"], "THX1138".partition("11")
61
- assert_equal ["THX", "11", "38"], "THX1138".partition(/\d\d/)
62
- assert_equal ["THX1138", "", ""], "THX1138".partition("99")
63
- end
64
- end
65
-
66
- context "#rpartition" do
67
- should "conform to doc" do
68
- assert_equal ["THX1", "1", "38"], "THX1138".rpartition("1")
69
- assert_equal ["THX1", "13", "8"], "THX1138".rpartition(/1\d/)
70
- assert_equal ["", "", "THX1138"], "THX1138".rpartition("99")
71
- end
72
- end
73
- end
74
- end
data/test/symbol_test.rb DELETED
@@ -1,23 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SymbolTest < Test::Unit::TestCase
4
- context "Symbol" do
5
- context "comparison" do
6
- should "work as expected" do
7
- assert_equal false, :abc == :def
8
- assert_equal true, :abc == :abc
9
- assert_equal false, :abc == "abc"
10
- assert_equal false, :abc > :def
11
- assert_equal true, :abc < :def
12
- assert_raise(ArgumentError) {:abc < "def"}
13
- end
14
- end
15
-
16
- context "string ops" do
17
- should "work as expected" do
18
- assert_equal :HELLO, :hello.upcase
19
- assert_equal 5, :hello.length
20
- end
21
- end
22
- end
23
- end
data/test/test_helper.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- require File.expand_path(File.dirname(__FILE__) + "/../lib/backports")
6
-
7
- # class Test::Unit::TestCase
8
- # end