spruz 0.2.7 → 0.2.8

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/Rakefile CHANGED
@@ -24,7 +24,7 @@ end
24
24
  desc "Testing library"
25
25
  task :test do
26
26
  ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -Ilib"
27
- sh 'testrb tests/test_*.rb'
27
+ sh 'testrb ./tests/test_*.rb'
28
28
  end
29
29
 
30
30
  desc "Testing library with coverage"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.8
@@ -23,4 +23,5 @@ module Spruz
23
23
  require 'spruz/deep_dup'
24
24
  require 'spruz/attempt'
25
25
  require 'spruz/hash_symbolize_keys_recursive'
26
+ require 'spruz/range_plus'
26
27
  end
@@ -5,6 +5,10 @@ module Spruz
5
5
  self
6
6
  end
7
7
 
8
+ def const_missing(*)
9
+ self
10
+ end
11
+
8
12
  def to_s
9
13
  ''
10
14
  end
@@ -0,0 +1,7 @@
1
+ module Spruz
2
+ module RangePlus
3
+ def +(other)
4
+ to_a + other.to_a
5
+ end
6
+ end
7
+ end
@@ -1,6 +1,6 @@
1
1
  module Spruz
2
2
  # Spruz version
3
- VERSION = '0.2.7'
3
+ VERSION = '0.2.8'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -17,4 +17,5 @@ module Spruz
17
17
  require 'spruz/xt/deep_dup'
18
18
  require 'spruz/xt/attempt'
19
19
  require 'spruz/xt/hash_symbolize_keys_recursive'
20
+ require 'spruz/xt/range_plus'
20
21
  end
@@ -0,0 +1,12 @@
1
+ require 'spruz/range_plus'
2
+
3
+ module Spruz
4
+ class ::Range
5
+ if method_defined?(:+)
6
+ warn "#{self}#+ already defined, didn't include at #{__FILE__}:#{__LINE__}"
7
+ else
8
+ include RangePlus
9
+ end
10
+ end
11
+ end
12
+
@@ -533,4 +533,15 @@ module Spruz
533
533
  assert_raise(Exception) { attempt(:attempts => 3, :exception_class => MyException) { raise Exception } }
534
534
  end
535
535
  end
536
+
537
+ class RangePlustTest < Test::Unit::TestCase
538
+ require 'spruz/xt/range_plus'
539
+
540
+ def test_range_plus
541
+ assert_equal [], (0...0) + (0...0)
542
+ assert_equal [ 0 ], (0..0) + (0...0)
543
+ assert_equal [ 0, 0 ], (0..0) + (0..0)
544
+ assert_equal((1..5).to_a, (1...3) + (3..5))
545
+ end
546
+ end
536
547
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spruz
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Florian Frank
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-20 00:00:00 Z
18
+ date: 2011-06-22 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: All the stuff that isn't good/big enough for a real library.
@@ -67,6 +67,7 @@ files:
67
67
  - lib/spruz/xt/partial_application.rb
68
68
  - lib/spruz/xt/time_dummy.rb
69
69
  - lib/spruz/xt/full.rb
70
+ - lib/spruz/xt/range_plus.rb
70
71
  - lib/spruz/xt/count_by.rb
71
72
  - lib/spruz/xt/blank.rb
72
73
  - lib/spruz/xt/uniq_by.rb
@@ -74,6 +75,7 @@ files:
74
75
  - lib/spruz/minimize.rb
75
76
  - lib/spruz/partial_application.rb
76
77
  - lib/spruz/time_dummy.rb
78
+ - lib/spruz/range_plus.rb
77
79
  - lib/spruz/count_by.rb
78
80
  - lib/spruz/uniq_by.rb
79
81
  - bin/enum
@@ -112,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
114
  requirements: []
113
115
 
114
116
  rubyforge_project:
115
- rubygems_version: 1.7.1
117
+ rubygems_version: 1.8.4
116
118
  signing_key:
117
119
  specification_version: 3
118
120
  summary: Useful stuff.