rdx 0.9.0.pre
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.
- checksums.yaml +7 -0
- data/.rdx +20 -0
- data/README +19 -0
- data/bin/rdx +7 -0
- data/examples/minimal/.rdx +8 -0
- data/examples/minimal/README +10 -0
- data/examples/minimal/lib/other_conventions.rb +64 -0
- data/examples/minimal/lib/the_basics.rb +94 -0
- data/examples/minimal/lib/using_directives.rb +66 -0
- data/examples/minimal/rakefile +27 -0
- data/examples/ruby-2.0.0-p0/README +7 -0
- data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/core/README +19 -0
- data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
- data/examples/ruby-2.0.0-p0/rakefile +165 -0
- data/lib/rdx.rb +331 -0
- data/lib/rdx/assertions.rb +484 -0
- data/lib/rdx/binding.rb +151 -0
- data/lib/rdx/code_object.rb +598 -0
- data/lib/rdx/comment.rb +338 -0
- data/lib/rdx/convention.rb +1174 -0
- data/lib/rdx/directive.rb +1432 -0
- data/lib/rdx/example.rb +679 -0
- data/lib/rdx/generator.rb +112 -0
- data/lib/rdx/generator/rdoc.rb +1006 -0
- data/lib/rdx/options.rb +359 -0
- data/lib/rdx/plain_text.rb +65 -0
- data/lib/rdx/reporter.rb +421 -0
- data/lib/rdx/ruby_lex.rb +324 -0
- data/lib/rdx/runner.rb +309 -0
- data/lib/rdx/source_file.rb +94 -0
- data/lib/rdx/specification.rb +194 -0
- data/lib/rdx/statement.rb +248 -0
- data/lib/rdx/store.rb +119 -0
- data/lib/rdx/task.rb +361 -0
- data/lib/rdx/text.rb +688 -0
- data/lib/rdx/version.rb +15 -0
- data/rakefile +64 -0
- metadata +203 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
--- core/orig/bignum.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/bignum.c 2015-06-19 06:44:58 +0000
|
3
|
+
@@ -3145,7 +3145,7 @@
|
4
|
+
*
|
5
|
+
* 123456789 ** 2 #=> 15241578750190521
|
6
|
+
* 123456789 ** 1.2 #=> 5126464716.09932
|
7
|
+
- * 123456789 ** -2 #=> 6.5610001194102e-17
|
8
|
+
+ * 123456789 ** -2 #=> 1/15241578750190521
|
9
|
+
*/
|
10
|
+
|
11
|
+
VALUE
|
@@ -0,0 +1,36 @@
|
|
1
|
+
--- core/orig/class.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/class.c 2015-06-11 07:51:45 +0000
|
3
|
+
@@ -1042,7 +1042,7 @@
|
4
|
+
* A.instance_methods #=> [:method1]
|
5
|
+
* B.instance_methods(false) #=> [:method2]
|
6
|
+
* C.instance_methods(false) #=> [:method3]
|
7
|
+
- * C.instance_methods(true).length #=> 43
|
8
|
+
+ * C.instance_methods(true).length #-> 43
|
9
|
+
*/
|
10
|
+
|
11
|
+
VALUE
|
12
|
+
@@ -1119,10 +1119,10 @@
|
13
|
+
* end
|
14
|
+
* end
|
15
|
+
* k = Klass.new
|
16
|
+
- * k.methods[0..9] #=> [:klass_method, :nil?, :===,
|
17
|
+
- * # :==~, :!, :eql?
|
18
|
+
+ * k.methods[0..9] #-> [:klass_method, :nil?, :===,
|
19
|
+
+ * # :=~, :!, :eql?,
|
20
|
+
* # :hash, :<=>, :class, :singleton_class]
|
21
|
+
- * k.methods.length #=> 57
|
22
|
+
+ * k.methods.length #-> 57
|
23
|
+
*/
|
24
|
+
|
25
|
+
VALUE
|
26
|
+
@@ -1218,8 +1218,8 @@
|
27
|
+
* end
|
28
|
+
*
|
29
|
+
* Single.singleton_methods #=> [:four]
|
30
|
+
- * a.singleton_methods(false) #=> [:two, :one]
|
31
|
+
- * a.singleton_methods #=> [:two, :one, :three]
|
32
|
+
+ * a.singleton_methods(false) #=> [:one, :two]
|
33
|
+
+ * a.singleton_methods #=> [:one, :two, :three]
|
34
|
+
*/
|
35
|
+
|
36
|
+
VALUE
|
@@ -0,0 +1,11 @@
|
|
1
|
+
--- core/orig/compar.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/compar.c 2015-06-11 07:51:46 +0000
|
3
|
+
@@ -216,7 +216,7 @@
|
4
|
+
* s1 < s2 #=> true
|
5
|
+
* s4.between?(s1, s3) #=> false
|
6
|
+
* s4.between?(s3, s5) #=> true
|
7
|
+
- * [ s3, s2, s5, s4, s1 ].sort #=> [Z, YY, XXX, WWWW, VVVVV]
|
8
|
+
+ * [ s3, s2, s5, s4, s1 ].sort # > [Z, YY, XXX, WWWW, VVVVV]
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
@@ -0,0 +1,301 @@
|
|
1
|
+
--- core/orig/complex.c 2015-06-11 07:51:43 +0000
|
2
|
+
+++ core/patched/complex.c 2015-06-28 11:38:56 +0000
|
3
|
+
@@ -440,7 +440,7 @@
|
4
|
+
*
|
5
|
+
* Returns a complex object which denotes the given rectangular form.
|
6
|
+
*
|
7
|
+
- * Complex.rectangular(1, 2) #=> (1+2i)
|
8
|
+
+ * Complex.rectangular(1, 2) #=> 1+2i
|
9
|
+
*/
|
10
|
+
static VALUE
|
11
|
+
nucomp_s_new(int argc, VALUE *argv, VALUE klass)
|
12
|
+
@@ -481,8 +481,8 @@
|
13
|
+
*
|
14
|
+
* Returns x+i*y;
|
15
|
+
*
|
16
|
+
- * Complex(1, 2) #=> (1+2i)
|
17
|
+
- * Complex('1+2i') #=> (1+2i)
|
18
|
+
+ * Complex(1, 2) #=> 1+2i
|
19
|
+
+ * Complex('1+2i') #=> 1+2i
|
20
|
+
*/
|
21
|
+
static VALUE
|
22
|
+
nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
|
23
|
+
@@ -592,10 +592,10 @@
|
24
|
+
*
|
25
|
+
* Returns a complex object which denotes the given polar form.
|
26
|
+
*
|
27
|
+
- * Complex.polar(3, 0) #=> (3.0+0.0i)
|
28
|
+
- * Complex.polar(3, Math::PI/2) #=> (1.836909530733566e-16+3.0i)
|
29
|
+
- * Complex.polar(3, Math::PI) #=> (-3.0+3.673819061467132e-16i)
|
30
|
+
- * Complex.polar(3, -Math::PI/2) #=> (1.836909530733566e-16-3.0i)
|
31
|
+
+ * Complex.polar(3, 0) #=> 3.0+0.0i
|
32
|
+
+ * Complex.polar(3, Math::PI/2) #=> 1.836909530733566e-16+3.0i
|
33
|
+
+ * Complex.polar(3, Math::PI) #=> -3.0+3.673819061467132e-16i
|
34
|
+
+ * Complex.polar(3, -Math::PI/2) #=> 1.836909530733566e-16-3.0i
|
35
|
+
*/
|
36
|
+
static VALUE
|
37
|
+
nucomp_s_polar(int argc, VALUE *argv, VALUE klass)
|
38
|
+
@@ -654,7 +654,7 @@
|
39
|
+
*
|
40
|
+
* Returns negation of the value.
|
41
|
+
*
|
42
|
+
- * -Complex(1, 2) #=> (-1-2i)
|
43
|
+
+ * -Complex(1, 2) #=> -1-2i
|
44
|
+
*/
|
45
|
+
static VALUE
|
46
|
+
nucomp_negate(VALUE self)
|
47
|
+
@@ -693,11 +693,11 @@
|
48
|
+
*
|
49
|
+
* Performs addition.
|
50
|
+
*
|
51
|
+
- * Complex(2, 3) + Complex(2, 3) #=> (4+6i)
|
52
|
+
- * Complex(900) + Complex(1) #=> (901+0i)
|
53
|
+
- * Complex(-2, 9) + Complex(-9, 2) #=> (-11+11i)
|
54
|
+
- * Complex(9, 8) + 4 #=> (13+8i)
|
55
|
+
- * Complex(20, 9) + 9.8 #=> (29.8+9i)
|
56
|
+
+ * Complex(2, 3) + Complex(2, 3) #=> 4+6i
|
57
|
+
+ * Complex(900) + Complex(1) #=> 901+0i
|
58
|
+
+ * Complex(-2, 9) + Complex(-9, 2) #=> -11+11i
|
59
|
+
+ * Complex(9, 8) + 4 #=> 13+8i
|
60
|
+
+ * Complex(20, 9) + 9.8 #=> 29.8+9i
|
61
|
+
*/
|
62
|
+
static VALUE
|
63
|
+
nucomp_add(VALUE self, VALUE other)
|
64
|
+
@@ -711,11 +711,11 @@
|
65
|
+
*
|
66
|
+
* Performs subtraction.
|
67
|
+
*
|
68
|
+
- * Complex(2, 3) - Complex(2, 3) #=> (0+0i)
|
69
|
+
- * Complex(900) - Complex(1) #=> (899+0i)
|
70
|
+
- * Complex(-2, 9) - Complex(-9, 2) #=> (7+7i)
|
71
|
+
- * Complex(9, 8) - 4 #=> (5+8i)
|
72
|
+
- * Complex(20, 9) - 9.8 #=> (10.2+9i)
|
73
|
+
+ * Complex(2, 3) - Complex(2, 3) #=> 0+0i
|
74
|
+
+ * Complex(900) - Complex(1) #=> 899+0i
|
75
|
+
+ * Complex(-2, 9) - Complex(-9, 2) #=> 7+7i
|
76
|
+
+ * Complex(9, 8) - 4 #=> 5+8i
|
77
|
+
+ * Complex(20, 9) - 9.8 #=> 10.2+9i
|
78
|
+
*/
|
79
|
+
static VALUE
|
80
|
+
nucomp_sub(VALUE self, VALUE other)
|
81
|
+
@@ -729,11 +729,11 @@
|
82
|
+
*
|
83
|
+
* Performs multiplication.
|
84
|
+
*
|
85
|
+
- * Complex(2, 3) * Complex(2, 3) #=> (-5+12i)
|
86
|
+
- * Complex(900) * Complex(1) #=> (900+0i)
|
87
|
+
- * Complex(-2, 9) * Complex(-9, 2) #=> (0-85i)
|
88
|
+
- * Complex(9, 8) * 4 #=> (36+32i)
|
89
|
+
- * Complex(20, 9) * 9.8 #=> (196.0+88.2i)
|
90
|
+
+ * Complex(2, 3) * Complex(2, 3) #=> -5+12i
|
91
|
+
+ * Complex(900) * Complex(1) #=> 900+0i
|
92
|
+
+ * Complex(-2, 9) * Complex(-9, 2) #=> 0-85i
|
93
|
+
+ * Complex(9, 8) * 4 #=> 36+32i
|
94
|
+
+ * Complex(20, 9) * 9.8 #=> 196.0+88.2i
|
95
|
+
*/
|
96
|
+
static VALUE
|
97
|
+
nucomp_mul(VALUE self, VALUE other)
|
98
|
+
@@ -821,11 +821,11 @@
|
99
|
+
*
|
100
|
+
* Performs division.
|
101
|
+
*
|
102
|
+
- * Complex(2, 3) / Complex(2, 3) #=> ((1/1)+(0/1)*i)
|
103
|
+
- * Complex(900) / Complex(1) #=> ((900/1)+(0/1)*i)
|
104
|
+
- * Complex(-2, 9) / Complex(-9, 2) #=> ((36/85)-(77/85)*i)
|
105
|
+
- * Complex(9, 8) / 4 #=> ((9/4)+(2/1)*i)
|
106
|
+
- * Complex(20, 9) / 9.8 #=> (2.0408163265306123+0.9183673469387754i)
|
107
|
+
+ * Complex(2, 3) / Complex(2, 3) # > ((1/1)+(0/1)*i)
|
108
|
+
+ * Complex(900) / Complex(1) # > ((900/1)+(0/1)*i)
|
109
|
+
+ * Complex(-2, 9) / Complex(-9, 2) # > ((36/85)-(77/85)*i)
|
110
|
+
+ * Complex(9, 8) / 4 # > ((9/4)+(2/1)*i)
|
111
|
+
+ * Complex(20, 9) / 9.8 # > (2.0408163265306123+0.9183673469387754i)
|
112
|
+
*/
|
113
|
+
static VALUE
|
114
|
+
nucomp_div(VALUE self, VALUE other)
|
115
|
+
@@ -841,7 +841,7 @@
|
116
|
+
*
|
117
|
+
* Performs division as each part is a float, never returns a float.
|
118
|
+
*
|
119
|
+
- * Complex(11, 22).fdiv(3) #=> (3.6666666666666665+7.333333333333333i)
|
120
|
+
+ * Complex(11, 22).fdiv(3) #=> 3.6666666666666665+7.333333333333333i
|
121
|
+
*/
|
122
|
+
static VALUE
|
123
|
+
nucomp_fdiv(VALUE self, VALUE other)
|
124
|
+
@@ -861,8 +861,8 @@
|
125
|
+
*
|
126
|
+
* Performs exponentiation.
|
127
|
+
*
|
128
|
+
- * Complex('i') ** 2 #=> (-1+0i)
|
129
|
+
- * Complex(-8) ** Rational(1, 3) #=> (1.0000000000000002+1.7320508075688772i)
|
130
|
+
+ * Complex('i') ** 2 #=> -1+0i
|
131
|
+
+ * Complex(-8) ** Rational(1, 3) #=> 1.0000000000000002+1.7320508075688772i
|
132
|
+
*/
|
133
|
+
static VALUE
|
134
|
+
nucomp_expt(VALUE self, VALUE other)
|
135
|
+
@@ -1087,7 +1087,7 @@
|
136
|
+
*
|
137
|
+
* Returns the complex conjugate.
|
138
|
+
*
|
139
|
+
- * Complex(1, 2).conjugate #=> (1-2i)
|
140
|
+
+ * Complex(1, 2).conjugate #=> 1-2i
|
141
|
+
*/
|
142
|
+
static VALUE
|
143
|
+
nucomp_conj(VALUE self)
|
144
|
+
@@ -1154,17 +1154,19 @@
|
145
|
+
* cmp.numerator -> numeric
|
146
|
+
*
|
147
|
+
* Returns the numerator.
|
148
|
+
+ * :rdx: off
|
149
|
+
*
|
150
|
+
* 1 2 3+4i <- numerator
|
151
|
+
* - + -i -> ----
|
152
|
+
* 2 3 6 <- denominator
|
153
|
+
*
|
154
|
+
- * c = Complex('1/2+2/3i') #=> ((1/2)+(2/3)*i)
|
155
|
+
- * n = c.numerator #=> (3+4i)
|
156
|
+
- * d = c.denominator #=> 6
|
157
|
+
- * n / d #=> ((1/2)+(2/3)*i)
|
158
|
+
+ * :rdx: on
|
159
|
+
+ * c = Complex('1/2+2/3i') # > ((1/2)+(2/3)*i)
|
160
|
+
+ * n = c.numerator # > (3+4i)
|
161
|
+
+ * d = c.denominator # > 6
|
162
|
+
+ * n / d # > ((1/2)+(2/3)*i)
|
163
|
+
* Complex(Rational(n.real, d), Rational(n.imag, d))
|
164
|
+
- * #=> ((1/2)+(2/3)*i)
|
165
|
+
+ * # > ((1/2)+(2/3)*i)
|
166
|
+
* See denominator.
|
167
|
+
*/
|
168
|
+
static VALUE
|
169
|
+
@@ -1379,8 +1381,8 @@
|
170
|
+
* should be exactly zero).
|
171
|
+
*
|
172
|
+
* Complex(1, 0).to_i #=> 1
|
173
|
+
- * Complex(1, 0.0).to_i # RangeError
|
174
|
+
- * Complex(1, 2).to_i # RangeError
|
175
|
+
+ * Complex(1, 0.0).to_i # raises RangeError
|
176
|
+
+ * Complex(1, 2).to_i # raises RangeError
|
177
|
+
*/
|
178
|
+
static VALUE
|
179
|
+
nucomp_to_i(VALUE self)
|
180
|
+
@@ -1403,8 +1405,8 @@
|
181
|
+
* be exactly zero).
|
182
|
+
*
|
183
|
+
* Complex(1, 0).to_f #=> 1.0
|
184
|
+
- * Complex(1, 0.0).to_f # RangeError
|
185
|
+
- * Complex(1, 2).to_f # RangeError
|
186
|
+
+ * Complex(1, 0.0).to_f # raises RangeError
|
187
|
+
+ * Complex(1, 2).to_f # raises RangeError
|
188
|
+
*/
|
189
|
+
static VALUE
|
190
|
+
nucomp_to_f(VALUE self)
|
191
|
+
@@ -1426,9 +1428,9 @@
|
192
|
+
* Returns the value as a rational if possible (the imaginary part
|
193
|
+
* should be exactly zero).
|
194
|
+
*
|
195
|
+
- * Complex(1, 0).to_r #=> (1/1)
|
196
|
+
- * Complex(1, 0.0).to_r # RangeError
|
197
|
+
- * Complex(1, 2).to_r # RangeError
|
198
|
+
+ * Complex(1, 0).to_r #=> 1/1
|
199
|
+
+ * Complex(1, 0.0).to_r # raises RangeError
|
200
|
+
+ * Complex(1, 2).to_r # raises RangeError
|
201
|
+
*
|
202
|
+
* See rationalize.
|
203
|
+
*/
|
204
|
+
@@ -1452,9 +1454,9 @@
|
205
|
+
* Returns the value as a rational if possible (the imaginary part
|
206
|
+
* should be exactly zero).
|
207
|
+
*
|
208
|
+
- * Complex(1.0/3, 0).rationalize #=> (1/3)
|
209
|
+
- * Complex(1, 0.0).rationalize # RangeError
|
210
|
+
- * Complex(1, 2).rationalize # RangeError
|
211
|
+
+ * Complex(1.0/3, 0).rationalize #=> 1/3
|
212
|
+
+ * Complex(1, 0.0).rationalize # raises RangeError
|
213
|
+
+ * Complex(1, 2).rationalize # raises RangeError
|
214
|
+
*
|
215
|
+
* See to_r.
|
216
|
+
*/
|
217
|
+
@@ -1479,8 +1481,8 @@
|
218
|
+
*
|
219
|
+
* Returns self.
|
220
|
+
*
|
221
|
+
- * Complex(2).to_c #=> (2+0i)
|
222
|
+
- * Complex(-8, 6).to_c #=> (-8+6i)
|
223
|
+
+ * Complex(2).to_c #=> 2+0i
|
224
|
+
+ * Complex(-8, 6).to_c #=> -8+6i
|
225
|
+
*/
|
226
|
+
static VALUE
|
227
|
+
nucomp_to_c(VALUE self)
|
228
|
+
@@ -1814,17 +1816,17 @@
|
229
|
+
* sequences can be separated by an underscore. Returns zero for null
|
230
|
+
* or garbage string.
|
231
|
+
*
|
232
|
+
- * '9'.to_c #=> (9+0i)
|
233
|
+
- * '2.5'.to_c #=> (2.5+0i)
|
234
|
+
- * '2.5/1'.to_c #=> ((5/2)+0i)
|
235
|
+
- * '-3/2'.to_c #=> ((-3/2)+0i)
|
236
|
+
- * '-i'.to_c #=> (0-1i)
|
237
|
+
- * '45i'.to_c #=> (0+45i)
|
238
|
+
- * '3-4i'.to_c #=> (3-4i)
|
239
|
+
- * '-4e2-4e-2i'.to_c #=> (-400.0-0.04i)
|
240
|
+
- * '-0.0-0.0i'.to_c #=> (-0.0-0.0i)
|
241
|
+
- * '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i)
|
242
|
+
- * 'ruby'.to_c #=> (0+0i)
|
243
|
+
+ * '9'.to_c # > (9+0i)
|
244
|
+
+ * '2.5'.to_c # > (2.5+0i)
|
245
|
+
+ * '2.5/1'.to_c # > ((5/2)+0i)
|
246
|
+
+ * '-3/2'.to_c # > ((-3/2)+0i)
|
247
|
+
+ * '-i'.to_c # > (0-1i)
|
248
|
+
+ * '45i'.to_c # > (0+45i)
|
249
|
+
+ * '3-4i'.to_c # > (3-4i)
|
250
|
+
+ * '-4e2-4e-2i'.to_c # > (-400.0-0.04i)
|
251
|
+
+ * '-0.0-0.0i'.to_c # > (-0.0-0.0i)
|
252
|
+
+ * '1/2+3/4i'.to_c # > ((1/2)+(3/4)*i)
|
253
|
+
+ * 'ruby'.to_c # > (0+0i)
|
254
|
+
*/
|
255
|
+
static VALUE
|
256
|
+
string_to_c(VALUE self)
|
257
|
+
@@ -2055,28 +2057,29 @@
|
258
|
+
* In ruby, you can create complex object with Complex, Complex::rect,
|
259
|
+
* Complex::polar or to_c method.
|
260
|
+
*
|
261
|
+
- * Complex(1) #=> (1+0i)
|
262
|
+
- * Complex(2, 3) #=> (2+3i)
|
263
|
+
- * Complex.polar(2, 3) #=> (-1.9799849932008908+0.2822400161197344i)
|
264
|
+
- * 3.to_c #=> (3+0i)
|
265
|
+
+ * Complex(1) # > (1+0i)
|
266
|
+
+ * Complex(2, 3) # > (2+3i)
|
267
|
+
+ * Complex.polar(2, 3) # > (-1.9799849932008908+0.2822400161197344i)
|
268
|
+
+ * 3.to_c # > (3+0i)
|
269
|
+
*
|
270
|
+
* You can also create complex object from floating-point numbers or
|
271
|
+
* strings.
|
272
|
+
*
|
273
|
+
- * Complex(0.3) #=> (0.3+0i)
|
274
|
+
- * Complex('0.3-0.5i') #=> (0.3-0.5i)
|
275
|
+
- * Complex('2/3+3/4i') #=> ((2/3)+(3/4)*i)
|
276
|
+
- * Complex('1@2') #=> (-0.4161468365471424+0.9092974268256817i)
|
277
|
+
- *
|
278
|
+
- * 0.3.to_c #=> (0.3+0i)
|
279
|
+
- * '0.3-0.5i'.to_c #=> (0.3-0.5i)
|
280
|
+
- * '2/3+3/4i'.to_c #=> ((2/3)+(3/4)*i)
|
281
|
+
- * '1@2'.to_c #=> (-0.4161468365471424+0.9092974268256817i)
|
282
|
+
+ * Complex(0.3) # > (0.3+0i)
|
283
|
+
+ * Complex('0.3-0.5i') # > (0.3-0.5i)
|
284
|
+
+ * Complex('2/3+3/4i') # > ((2/3)+(3/4)*i)
|
285
|
+
+ * Complex('1@2') # > (-0.4161468365471424+0.9092974268256817i)
|
286
|
+
+ *
|
287
|
+
+ * 0.3.to_c # > (0.3+0i)
|
288
|
+
+ * '0.3-0.5i'.to_c # > (0.3-0.5i)
|
289
|
+
+ * '2/3+3/4i'.to_c # > ((2/3)+(3/4)*i)
|
290
|
+
+ * '1@2'.to_c # > (-0.4161468365471424+0.9092974268256817i)
|
291
|
+
*
|
292
|
+
* A complex object is either an exact or an inexact number.
|
293
|
+
*
|
294
|
+
- * Complex(1, 1) / 2 #=> ((1/2)+(1/2)*i)
|
295
|
+
- * Complex(1, 1) / 2.0 #=> (0.5+0.5i)
|
296
|
+
+ * Complex(1, 1) / 2 # > ((1/2)+(1/2)*i)
|
297
|
+
+ * :rdx: bug the result is again ((1/2)+(1/2)*i)
|
298
|
+
+ * Complex(1, 1) / 2.0 # > (0.5+0.5i)
|
299
|
+
*/
|
300
|
+
void
|
301
|
+
Init_Complex(void)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
--- core/orig/cont.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/cont.c 2015-06-12 23:25:36 +0000
|
3
|
+
@@ -965,15 +965,9 @@
|
4
|
+
* 2
|
5
|
+
* end
|
6
|
+
*
|
7
|
+
- * puts fiber.resume
|
8
|
+
- * puts fiber.resume
|
9
|
+
- * puts fiber.resume
|
10
|
+
- *
|
11
|
+
- * <em>produces</em>
|
12
|
+
- *
|
13
|
+
- * 1
|
14
|
+
- * 2
|
15
|
+
- * FiberError: dead fiber called
|
16
|
+
+ * fiber.resume #=> 1
|
17
|
+
+ * fiber.resume #=> 2
|
18
|
+
+ * fiber.resume # raises FiberError: dead fiber called
|
19
|
+
*
|
20
|
+
* The <code>Fiber#resume</code> method accepts an arbitrary number of
|
21
|
+
* parameters, if it is the first call to <code>resume</code> then they
|
22
|
+
@@ -986,15 +980,9 @@
|
23
|
+
* second = Fiber.yield first + 2
|
24
|
+
* end
|
25
|
+
*
|
26
|
+
- * puts fiber.resume 10
|
27
|
+
- * puts fiber.resume 14
|
28
|
+
- * puts fiber.resume 18
|
29
|
+
- *
|
30
|
+
- * <em>produces</em>
|
31
|
+
- *
|
32
|
+
- * 12
|
33
|
+
- * 14
|
34
|
+
- * FiberError: dead fiber called
|
35
|
+
+ * fiber.resume 10 #=> 12
|
36
|
+
+ * fiber.resume 14 #=> 14
|
37
|
+
+ * fiber.resume 18 # raises FiberError: dead fiber called
|
38
|
+
*
|
39
|
+
*/
|
40
|
+
|
41
|
+
@@ -1455,11 +1443,11 @@
|
42
|
+
* fiber2.resume
|
43
|
+
* fiber3.resume
|
44
|
+
*
|
45
|
+
- * <em>produces</em>
|
46
|
+
+ * <em>produces</em>
|
47
|
+
*
|
48
|
+
- * In fiber 2
|
49
|
+
- * In fiber 1
|
50
|
+
- * In fiber 3
|
51
|
+
+ * In Fiber 2
|
52
|
+
+ * In Fiber 1
|
53
|
+
+ * In Fiber 3
|
54
|
+
*
|
55
|
+
*/
|
56
|
+
static VALUE
|
57
|
+
@@ -1513,7 +1501,7 @@
|
58
|
+
*
|
59
|
+
* fiber = Fiber.new{}
|
60
|
+
* fiber.resume #=> nil
|
61
|
+
- * fiber.resume #=> FiberError: dead fiber called
|
62
|
+
+ * fiber.resume # raises FiberError: dead fiber called
|
63
|
+
*/
|
64
|
+
|
65
|
+
void
|
@@ -0,0 +1,147 @@
|
|
1
|
+
--- core/orig/dir.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/dir.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -644,7 +644,7 @@
|
4
|
+
* d = Dir.new("testdir")
|
5
|
+
* d.tell #=> 0
|
6
|
+
* d.read #=> "."
|
7
|
+
- * d.tell #=> 12
|
8
|
+
+ * d.tell #=> 1
|
9
|
+
*/
|
10
|
+
static VALUE
|
11
|
+
dir_tell(VALUE dir)
|
12
|
+
@@ -668,11 +668,11 @@
|
13
|
+
* Seeks to a particular location in <em>dir</em>. <i>integer</i>
|
14
|
+
* must be a value returned by <code>Dir#tell</code>.
|
15
|
+
*
|
16
|
+
- * d = Dir.new("testdir") #=> #<Dir:0x401b3c40>
|
17
|
+
+ * d = Dir.new("testdir") # > #<Dir:testdir>
|
18
|
+
* d.read #=> "."
|
19
|
+
- * i = d.tell #=> 12
|
20
|
+
+ * i = d.tell #=> 1
|
21
|
+
* d.read #=> ".."
|
22
|
+
- * d.seek(i) #=> #<Dir:0x401b3c40>
|
23
|
+
+ * d.seek(i) # > #<Dir:testdir>
|
24
|
+
* d.read #=> ".."
|
25
|
+
*/
|
26
|
+
static VALUE
|
27
|
+
@@ -696,11 +696,11 @@
|
28
|
+
* Synonym for <code>Dir#seek</code>, but returns the position
|
29
|
+
* parameter.
|
30
|
+
*
|
31
|
+
- * d = Dir.new("testdir") #=> #<Dir:0x401b3c40>
|
32
|
+
+ * d = Dir.new("testdir") # > #<Dir:testdir>
|
33
|
+
* d.read #=> "."
|
34
|
+
- * i = d.pos #=> 12
|
35
|
+
+ * i = d.pos #=> 1
|
36
|
+
* d.read #=> ".."
|
37
|
+
- * d.pos = i #=> 12
|
38
|
+
+ * d.pos = i #=> 1
|
39
|
+
* d.read #=> ".."
|
40
|
+
*/
|
41
|
+
static VALUE
|
42
|
+
@@ -718,7 +718,7 @@
|
43
|
+
*
|
44
|
+
* d = Dir.new("testdir")
|
45
|
+
* d.read #=> "."
|
46
|
+
- * d.rewind #=> #<Dir:0x401b3fb0>
|
47
|
+
+ * d.rewind # > #<Dir:testdir>
|
48
|
+
* d.read #=> "."
|
49
|
+
*/
|
50
|
+
static VALUE
|
51
|
+
@@ -814,6 +814,7 @@
|
52
|
+
* to open a <code>chdir</code> block while another thread has one
|
53
|
+
* open.
|
54
|
+
*
|
55
|
+
+ * :rdx: off
|
56
|
+
* Dir.chdir("/var/spool/mail")
|
57
|
+
* puts Dir.pwd
|
58
|
+
* Dir.chdir("/tmp") do
|
59
|
+
@@ -893,6 +894,7 @@
|
60
|
+
* Returns the path to the current working directory of this process as
|
61
|
+
* a string.
|
62
|
+
*
|
63
|
+
+ * :rdx: if File.directory? '/tmp'
|
64
|
+
* Dir.chdir("/tmp") #=> 0
|
65
|
+
* Dir.getwd #=> "/tmp"
|
66
|
+
*/
|
67
|
+
@@ -957,7 +959,7 @@
|
68
|
+
* also the discussion of permissions in the class documentation for
|
69
|
+
* <code>File</code>.
|
70
|
+
*
|
71
|
+
- * Dir.mkdir(File.join(Dir.home, ".foo"), 0700) #=> 0
|
72
|
+
+ * Dir.mkdir(File.join(Dir.pwd, ".foo"), 0700) #=> 0
|
73
|
+
*
|
74
|
+
*/
|
75
|
+
static VALUE
|
76
|
+
@@ -1804,6 +1806,9 @@
|
77
|
+
* i.e. <code>Dir["c:\\foo*"]</code> will not work,
|
78
|
+
* use <code>Dir["c:/foo*"]</code> instead.
|
79
|
+
*
|
80
|
+
+ * :rdx: no_warnings stderr
|
81
|
+
+ * Dir.chdir 'testdir'
|
82
|
+
+ * :rdx:
|
83
|
+
* Dir["config.?"] #=> ["config.h"]
|
84
|
+
* Dir.glob("config.?") #=> ["config.h"]
|
85
|
+
* Dir.glob("*.[a-z][a-z]") #=> ["main.rb"]
|
86
|
+
@@ -1812,16 +1817,33 @@
|
87
|
+
* Dir.glob("*") #=> ["config.h", "main.rb"]
|
88
|
+
* Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "..", "config.h", "main.rb"]
|
89
|
+
*
|
90
|
+
+ * Now let's enhance the tree structure in order to show other stuff:
|
91
|
+
+ * :rdx: off -
|
92
|
+
+ * testdir (Dir.pwd)
|
93
|
+
+ * |- config.h
|
94
|
+
+ * |- main.rb
|
95
|
+
+ * +- lib
|
96
|
+
+ * |- song.rb
|
97
|
+
+ * +- song
|
98
|
+
+ * +- karaoke.rb
|
99
|
+
+ *-- rdx
|
100
|
+
+ * :rdx:
|
101
|
+
+ * FileUtils.mkpath 'lib/song'
|
102
|
+
+ * File.write 'lib/song.rb', 'rb'
|
103
|
+
+ * File.write 'lib/song/karaoke.rb', 'rb'
|
104
|
+
+ *++
|
105
|
+
+ * Returning to the examples:
|
106
|
+
+ *
|
107
|
+
* rbfiles = File.join("**", "*.rb")
|
108
|
+
- * Dir.glob(rbfiles) #=> ["main.rb",
|
109
|
+
+ * Dir.glob(rbfiles) #=> ["lib/song/karaoke.rb",
|
110
|
+
* # "lib/song.rb",
|
111
|
+
- * # "lib/song/karaoke.rb"]
|
112
|
+
+ * # "main.rb",]
|
113
|
+
* libdirs = File.join("**", "lib")
|
114
|
+
* Dir.glob(libdirs) #=> ["lib"]
|
115
|
+
*
|
116
|
+
* librbfiles = File.join("**", "lib", "**", "*.rb")
|
117
|
+
- * Dir.glob(librbfiles) #=> ["lib/song.rb",
|
118
|
+
- * # "lib/song/karaoke.rb"]
|
119
|
+
+ * Dir.glob(librbfiles) #=> ["lib/song/karaoke.rb",
|
120
|
+
+ * # "lib/song.rb"]
|
121
|
+
*
|
122
|
+
* librbfiles = File.join("**", "lib", "*.rb")
|
123
|
+
* Dir.glob(librbfiles) #=> ["lib/song.rb"]
|
124
|
+
@@ -2086,6 +2108,23 @@
|
125
|
+
* (<code>config.h</code> and <code>main.rb</code>), the parent
|
126
|
+
* directory (<code>..</code>), and the directory itself
|
127
|
+
* (<code>.</code>).
|
128
|
+
+ *
|
129
|
+
+ * In the following examples we assume that we are located in a temporary
|
130
|
+
+ * directory with the following structure:
|
131
|
+
+ *
|
132
|
+
+ * :rdx: off -
|
133
|
+
+ *
|
134
|
+
+ * Dir.pwd
|
135
|
+
+ * +- testdir
|
136
|
+
+ * |- config.h
|
137
|
+
+ * +- main.rb
|
138
|
+
+ *
|
139
|
+
+ * :rdx: in_tmpdir!!
|
140
|
+
+ *
|
141
|
+
+ * :rdx: setup
|
142
|
+
+ * Dir.mkdir 'testdir'
|
143
|
+
+ * File.write 'testdir/config.h', 'h'
|
144
|
+
+ * File.write 'testdir/main.rb', 'rb'
|
145
|
+
*/
|
146
|
+
void
|
147
|
+
Init_Dir(void)
|