kagemusha 0.0.6 → 0.0.7
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/Manifest.txt +2 -0
- data/lib/kagemusha/composite.rb +41 -0
- data/lib/kagemusha/version.rb +2 -2
- data/script/console.cmd +0 -0
- data/script/destroy.cmd +0 -0
- data/script/generate.cmd +0 -0
- data/script/txt2html.cmd +0 -0
- metadata +10 -8
data/Manifest.txt
CHANGED
@@ -14,6 +14,7 @@ examples/rand.rb
|
|
14
14
|
examples/style.rb
|
15
15
|
examples/time.rb
|
16
16
|
lib/kagemusha.rb
|
17
|
+
lib/kagemusha/composite.rb
|
17
18
|
lib/kagemusha/core.rb
|
18
19
|
lib/kagemusha/date.rb
|
19
20
|
lib/kagemusha/datetime.rb
|
@@ -34,6 +35,7 @@ tasks/environment.rake
|
|
34
35
|
tasks/website.rake
|
35
36
|
test/test_bugs.rb
|
36
37
|
test/test_complex_cases.rb
|
38
|
+
test/test_composite.rb
|
37
39
|
test/test_date.rb
|
38
40
|
test/test_datetime.rb
|
39
41
|
test/test_helper.rb
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
#==============================================================================#
|
3
|
+
# $Id: composite.rb 99 2008-07-17 13:56:26Z yuyakato $
|
4
|
+
#==============================================================================#
|
5
|
+
|
6
|
+
class Kagemusha
|
7
|
+
class Composite
|
8
|
+
def initialize(*mocks)
|
9
|
+
@mocks = []
|
10
|
+
mocks.each { |mock| self << mock }
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_reader :mocks
|
14
|
+
|
15
|
+
def size
|
16
|
+
return @mocks.size
|
17
|
+
end
|
18
|
+
|
19
|
+
def add(mock)
|
20
|
+
raise(ArgumentError) unless mock.kind_of?(Kagemusha) || mock.kind_of?(Kagemusha::Composite)
|
21
|
+
@mocks << mock
|
22
|
+
return self
|
23
|
+
end
|
24
|
+
alias << add
|
25
|
+
|
26
|
+
def concat(mock)
|
27
|
+
return self.class.new(*self.mocks) << mock
|
28
|
+
end
|
29
|
+
alias + concat
|
30
|
+
|
31
|
+
def swap(&block)
|
32
|
+
src = (0...self.size).to_a.reverse.inject("return yield") { |memo, index|
|
33
|
+
"@mocks[#{index}].swap { #{memo} }"
|
34
|
+
}
|
35
|
+
return eval(src, &block)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
#==============================================================================#
|
41
|
+
#==============================================================================#
|
data/lib/kagemusha/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
2
|
#==============================================================================#
|
3
|
-
# $Id: version.rb
|
3
|
+
# $Id: version.rb 103 2008-07-19 06:13:27Z yuyakato $
|
4
4
|
#==============================================================================#
|
5
5
|
|
6
6
|
class Kagemusha #:nodoc:
|
7
7
|
module VERSION #:nodoc:
|
8
8
|
MAJOR = 0
|
9
9
|
MINOR = 0
|
10
|
-
TINY =
|
10
|
+
TINY = 7
|
11
11
|
|
12
12
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
13
13
|
end
|
data/script/console.cmd
CHANGED
File without changes
|
data/script/destroy.cmd
CHANGED
File without changes
|
data/script/generate.cmd
CHANGED
File without changes
|
data/script/txt2html.cmd
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kagemusha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya Kato
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-19 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- examples/style.rb
|
55
55
|
- examples/time.rb
|
56
56
|
- lib/kagemusha.rb
|
57
|
+
- lib/kagemusha/composite.rb
|
57
58
|
- lib/kagemusha/core.rb
|
58
59
|
- lib/kagemusha/date.rb
|
59
60
|
- lib/kagemusha/datetime.rb
|
@@ -74,6 +75,7 @@ files:
|
|
74
75
|
- tasks/website.rake
|
75
76
|
- test/test_bugs.rb
|
76
77
|
- test/test_complex_cases.rb
|
78
|
+
- test/test_composite.rb
|
77
79
|
- test/test_date.rb
|
78
80
|
- test/test_datetime.rb
|
79
81
|
- test/test_helper.rb
|
@@ -113,12 +115,12 @@ signing_key:
|
|
113
115
|
specification_version: 2
|
114
116
|
summary: Kagemusha is a library of helper functions for testing Ruby scripts.
|
115
117
|
test_files:
|
118
|
+
- test/test_kagemusha.rb
|
119
|
+
- test/test_helper.rb
|
120
|
+
- test/test_datetime.rb
|
121
|
+
- test/test_time.rb
|
122
|
+
- test/test_rand.rb
|
123
|
+
- test/test_date.rb
|
116
124
|
- test/test_bugs.rb
|
117
125
|
- test/test_complex_cases.rb
|
118
126
|
- test/test_composite.rb
|
119
|
-
- test/test_date.rb
|
120
|
-
- test/test_datetime.rb
|
121
|
-
- test/test_helper.rb
|
122
|
-
- test/test_kagemusha.rb
|
123
|
-
- test/test_rand.rb
|
124
|
-
- test/test_time.rb
|