ruby_patch 0.1.0 → 0.2.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.
- data/lib/ruby_patch/class.rb +4 -0
- data/lib/ruby_patch/enumerable.rb +7 -0
- data/lib/ruby_patch/object.rb +3 -0
- data/lib/ruby_patch/version.rb +1 -1
- data/lib/ruby_patch.rb +1 -0
- data/ruby_patch.gemspec +3 -3
- data/spec/ruby_patch/class_spec.rb +11 -0
- data/spec/ruby_patch/enumerable_spec.rb +21 -0
- data/spec/ruby_patch/object_spec.rb +15 -0
- metadata +14 -11
data/lib/ruby_patch/class.rb
CHANGED
data/lib/ruby_patch/object.rb
CHANGED
data/lib/ruby_patch/version.rb
CHANGED
data/lib/ruby_patch.rb
CHANGED
data/ruby_patch.gemspec
CHANGED
@@ -5,10 +5,10 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = 'ruby_patch'
|
6
6
|
s.summary = "Monky patches for ruby."
|
7
7
|
s.version = RubyPatch::VERSION
|
8
|
-
s.add_development_dependency 'rspec', '~> 2'
|
9
|
-
s.add_development_dependency 'simplecov', '~> 0'
|
8
|
+
s.add_development_dependency 'rspec', '~> 2.10'
|
9
|
+
s.add_development_dependency 'simplecov', '~> 0.6'
|
10
10
|
s.author = 'kshramt'
|
11
11
|
s.description = "Monkey patches used by kshramt's libraries."
|
12
|
-
s.required_ruby_version = '
|
12
|
+
s.required_ruby_version = '~> 1.9'
|
13
13
|
s.test_files.concat `git ls-files spec`.split.select{|path| path =~ /_spec\.rb/}
|
14
14
|
end
|
@@ -8,6 +8,17 @@ describe Class do
|
|
8
8
|
class Dummy::Child < Dummy; end
|
9
9
|
class Dummy::Child::GrandChild < Dummy::Child; end
|
10
10
|
end
|
11
|
+
|
12
|
+
describe '#posterity_of?' do
|
13
|
+
it do
|
14
|
+
Integer.posterity_of?(Numeric).should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
it do
|
18
|
+
Symbol.posterity_of?(Numeric).should be_false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
11
22
|
describe '#posterities' do
|
12
23
|
it do
|
13
24
|
Dummy.posterities.sort.should == [Dummy::Child, Dummy::Child::GrandChild].sort
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ruby_patch'
|
3
|
+
|
4
|
+
describe Enumerable do
|
5
|
+
describe 'classify' do
|
6
|
+
it do
|
7
|
+
(1..4).classify{|i| i.odd?}.should == {
|
8
|
+
true => [1, 3],
|
9
|
+
false => [2, 4],
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
it do
|
14
|
+
[1, '1', :'1'].classify{|v| v.class}.should == {
|
15
|
+
Fixnum => [1],
|
16
|
+
String => ['1'],
|
17
|
+
Symbol => [:'1'],
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -3,6 +3,21 @@ require 'spec_helper'
|
|
3
3
|
require 'ruby_patch/object'
|
4
4
|
|
5
5
|
describe Object do
|
6
|
+
|
7
|
+
describe '#exception?' do
|
8
|
+
context 'Posterity of Exception' do
|
9
|
+
it do
|
10
|
+
StandardError.new.should be_true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'Not a posterity of Exception' do
|
15
|
+
it do
|
16
|
+
3.exception?.should be_false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
6
21
|
describe '#__DIR__' do
|
7
22
|
it do
|
8
23
|
__DIR__.should == File.dirname(__FILE__)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,30 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154059860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2'
|
21
|
+
version: '2.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154059860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: simplecov
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154059240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
32
|
+
version: '0.6'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154059240
|
36
36
|
description: Monkey patches used by kshramt's libraries.
|
37
37
|
email:
|
38
38
|
executables: []
|
@@ -41,6 +41,7 @@ extra_rdoc_files: []
|
|
41
41
|
files:
|
42
42
|
- lib/ruby_patch.rb
|
43
43
|
- lib/ruby_patch/class.rb
|
44
|
+
- lib/ruby_patch/enumerable.rb
|
44
45
|
- lib/ruby_patch/object.rb
|
45
46
|
- lib/ruby_patch/string.rb
|
46
47
|
- lib/ruby_patch/time.rb
|
@@ -48,6 +49,7 @@ files:
|
|
48
49
|
- rakefile
|
49
50
|
- ruby_patch.gemspec
|
50
51
|
- spec/ruby_patch/class_spec.rb
|
52
|
+
- spec/ruby_patch/enumerable_spec.rb
|
51
53
|
- spec/ruby_patch/object_spec.rb
|
52
54
|
- spec/ruby_patch/string_spec.rb
|
53
55
|
- spec/ruby_patch/time_spec.rb
|
@@ -62,9 +64,9 @@ require_paths:
|
|
62
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
65
|
none: false
|
64
66
|
requirements:
|
65
|
-
- -
|
67
|
+
- - ~>
|
66
68
|
- !ruby/object:Gem::Version
|
67
|
-
version: 1.9
|
69
|
+
version: '1.9'
|
68
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
71
|
none: false
|
70
72
|
requirements:
|
@@ -73,12 +75,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
75
|
version: '0'
|
74
76
|
requirements: []
|
75
77
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.8.
|
78
|
+
rubygems_version: 1.8.15
|
77
79
|
signing_key:
|
78
80
|
specification_version: 3
|
79
81
|
summary: Monky patches for ruby.
|
80
82
|
test_files:
|
81
83
|
- spec/ruby_patch/class_spec.rb
|
84
|
+
- spec/ruby_patch/enumerable_spec.rb
|
82
85
|
- spec/ruby_patch/object_spec.rb
|
83
86
|
- spec/ruby_patch/string_spec.rb
|
84
87
|
- spec/ruby_patch/time_spec.rb
|