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,53 @@
|
|
1
|
+
--- core/orig/load.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/load.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -730,6 +730,8 @@
|
4
|
+
* loaded again if its path already appears in <code>$"</code>. For example,
|
5
|
+
* <code>require 'a'; require './a'</code> will not load <code>a.rb</code>
|
6
|
+
* again.
|
7
|
+
+ *
|
8
|
+
+ * :rdx: off -
|
9
|
+
*
|
10
|
+
* require "my-library.rb"
|
11
|
+
* require "db-driver"
|
12
|
+
@@ -986,11 +988,20 @@
|
13
|
+
* Registers _filename_ to be loaded (using <code>Kernel::require</code>)
|
14
|
+
* the first time that _module_ (which may be a <code>String</code> or
|
15
|
+
* a symbol) is accessed in the namespace of _mod_.
|
16
|
+
- *
|
17
|
+
+ *
|
18
|
+
+ * # File: b.rb
|
19
|
+
+ * class A::B; end
|
20
|
+
+ * puts 'File b required!'
|
21
|
+
+ *
|
22
|
+
+ * :rdx: toplevel
|
23
|
+
+ * # in main
|
24
|
+
* module A
|
25
|
+
* end
|
26
|
+
- * A.autoload(:B, "b")
|
27
|
+
- * A::B.doit # autoloads "b"
|
28
|
+
+ * A.autoload(:B, File.expand_path("b"))
|
29
|
+
+ * A::B # prints: File b required!
|
30
|
+
+ *-- rdx
|
31
|
+
+ * Object.send :remove_const, :A
|
32
|
+
+ *++
|
33
|
+
*/
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
@@ -1033,6 +1044,8 @@
|
37
|
+
* Registers _filename_ to be loaded (using <code>Kernel::require</code>)
|
38
|
+
* the first time that _module_ (which may be a <code>String</code> or
|
39
|
+
* a symbol) is accessed.
|
40
|
+
+ *
|
41
|
+
+ * :rdx: off
|
42
|
+
*
|
43
|
+
* autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")
|
44
|
+
*/
|
45
|
+
@@ -1054,6 +1067,8 @@
|
46
|
+
* Returns _filename_ to be loaded if _name_ is registered as
|
47
|
+
* +autoload+.
|
48
|
+
*
|
49
|
+
+ * :rdx: off
|
50
|
+
+ *
|
51
|
+
* autoload(:B, "b")
|
52
|
+
* autoload?(:B) #=> "b"
|
53
|
+
*/
|
@@ -0,0 +1,98 @@
|
|
1
|
+
--- core/orig/marshal.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/marshal.c 2015-06-19 21:20:55 +0000
|
3
|
+
@@ -890,6 +890,7 @@
|
4
|
+
* traversal of subobjects will be limited to that depth. If limit is
|
5
|
+
* negative, no checking of depth will be performed.
|
6
|
+
*
|
7
|
+
+ * :rdx: toplevel
|
8
|
+
* class Klass
|
9
|
+
* def initialize(str)
|
10
|
+
* @str = str
|
11
|
+
@@ -899,12 +900,14 @@
|
12
|
+
* end
|
13
|
+
* end
|
14
|
+
*
|
15
|
+
- * (produces no output)
|
16
|
+
- *
|
17
|
+
* o = Klass.new("hello\n")
|
18
|
+
* data = Marshal.dump(o)
|
19
|
+
* obj = Marshal.load(data)
|
20
|
+
* obj.say_hello #=> "hello\n"
|
21
|
+
+ *
|
22
|
+
+ *-- rdx
|
23
|
+
+ * Object.send :remove_const, :Klass
|
24
|
+
+ *++
|
25
|
+
*
|
26
|
+
* Marshal can't dump following objects:
|
27
|
+
* * anonymous Class/Module.
|
28
|
+
@@ -1973,9 +1976,8 @@
|
29
|
+
* first two bytes of marshaled data.
|
30
|
+
*
|
31
|
+
* str = Marshal.dump("thing")
|
32
|
+
- * RUBY_VERSION #=> "1.9.0"
|
33
|
+
- * str[0].ord #=> 4
|
34
|
+
- * str[1].ord #=> 8
|
35
|
+
+ * str.getbyte(0) #=> 4
|
36
|
+
+ * str.getbyte(1) #=> 8
|
37
|
+
*
|
38
|
+
* Some objects cannot be dumped: if the objects to be dumped include
|
39
|
+
* bindings, procedure or method objects, instances of class IO, or
|
40
|
+
@@ -2017,8 +2019,10 @@
|
41
|
+
* marshal_load must recreate the object from the information in the result.
|
42
|
+
*
|
43
|
+
* Example:
|
44
|
+
- *
|
45
|
+
+ * :rdx: toplevel
|
46
|
+
+ *
|
47
|
+
* class MyObj
|
48
|
+
+ * attr_reader :name, :version, :data
|
49
|
+
* def initialize name, version, data
|
50
|
+
* @name = name
|
51
|
+
* @version = version
|
52
|
+
@@ -2033,7 +2037,17 @@
|
53
|
+
* @name, @version = array
|
54
|
+
* end
|
55
|
+
* end
|
56
|
+
- *
|
57
|
+
+ *
|
58
|
+
+ * obj = MyObj.new "MyName", 1.0, "secret data"
|
59
|
+
+ * new_obj = Marshal.load(Marshal.dump(obj))
|
60
|
+
+ * obj.name == new_obj.name #=> true
|
61
|
+
+ * obj.version == new_obj.version #=> true
|
62
|
+
+ * new_obj.data #=> nil
|
63
|
+
+ * # The requested informations has been copied successfully!
|
64
|
+
+ *-- rdx
|
65
|
+
+ * Object.send :remove_const, :MyObj
|
66
|
+
+ *++
|
67
|
+
+ *
|
68
|
+
* == _dump and _load
|
69
|
+
*
|
70
|
+
* Use _dump and _load when you need to allocate the object you're restoring
|
71
|
+
@@ -2050,6 +2064,7 @@
|
72
|
+
* Example:
|
73
|
+
*
|
74
|
+
* class MyObj
|
75
|
+
+ * attr_reader :name, :version, :data
|
76
|
+
* def initialize name, version, data
|
77
|
+
* @name = name
|
78
|
+
* @version = version
|
79
|
+
@@ -2060,10 +2075,17 @@
|
80
|
+
* [@name, @version].join ':'
|
81
|
+
* end
|
82
|
+
*
|
83
|
+
- * def self._load args
|
84
|
+
- * new(*args.split(':'))
|
85
|
+
+ * def self._load string
|
86
|
+
+ * new(*string.split(':'),'Unknown data')
|
87
|
+
* end
|
88
|
+
* end
|
89
|
+
+ *
|
90
|
+
+ * obj = MyObj.new :the_name, 1.0, 'secret data'
|
91
|
+
+ * new_obj = Marshal.load(Marshal.dump(obj))
|
92
|
+
+ * new_obj.data #=> 'Unknown data'
|
93
|
+
+ *-- rdx
|
94
|
+
+ * Object.send :remove_const, :MyObj
|
95
|
+
+ *++
|
96
|
+
*
|
97
|
+
* Since Marhsal.dump outputs a string you can have _dump return a Marshal
|
98
|
+
* string which is Marshal.loaded in _load for complex objects.
|
@@ -0,0 +1,110 @@
|
|
1
|
+
--- core/orig/math.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/math.c 2015-06-19 21:23:37 +0000
|
3
|
+
@@ -443,7 +443,7 @@
|
4
|
+
* 0.upto(10) {|x|
|
5
|
+
* p [x, Math.sqrt(x), Math.sqrt(x)**2]
|
6
|
+
* }
|
7
|
+
- * #=>
|
8
|
+
+ * produces:
|
9
|
+
* [0, 0.0, 0.0]
|
10
|
+
* [1, 1.0, 1.0]
|
11
|
+
* [2, 1.4142135623731, 2.0]
|
12
|
+
@@ -481,7 +481,7 @@
|
13
|
+
* -9.upto(9) {|x|
|
14
|
+
* p [x, Math.cbrt(x), Math.cbrt(x)**3]
|
15
|
+
* }
|
16
|
+
- * #=>
|
17
|
+
+ * produces:
|
18
|
+
* [-9, -2.0800838230519, -9.0]
|
19
|
+
* [-8, -2.0, -8.0]
|
20
|
+
* [-7, -1.91293118277239, -7.0]
|
21
|
+
@@ -608,32 +608,33 @@
|
22
|
+
*
|
23
|
+
* def fact(n) (1..n).inject(1) {|r,i| r*i } end
|
24
|
+
* 1.upto(26) {|i| p [i, Math.gamma(i), fact(i-1)] }
|
25
|
+
- * #=> [1, 1.0, 1]
|
26
|
+
- * # [2, 1.0, 1]
|
27
|
+
- * # [3, 2.0, 2]
|
28
|
+
- * # [4, 6.0, 6]
|
29
|
+
- * # [5, 24.0, 24]
|
30
|
+
- * # [6, 120.0, 120]
|
31
|
+
- * # [7, 720.0, 720]
|
32
|
+
- * # [8, 5040.0, 5040]
|
33
|
+
- * # [9, 40320.0, 40320]
|
34
|
+
- * # [10, 362880.0, 362880]
|
35
|
+
- * # [11, 3628800.0, 3628800]
|
36
|
+
- * # [12, 39916800.0, 39916800]
|
37
|
+
- * # [13, 479001600.0, 479001600]
|
38
|
+
- * # [14, 6227020800.0, 6227020800]
|
39
|
+
- * # [15, 87178291200.0, 87178291200]
|
40
|
+
- * # [16, 1307674368000.0, 1307674368000]
|
41
|
+
- * # [17, 20922789888000.0, 20922789888000]
|
42
|
+
- * # [18, 355687428096000.0, 355687428096000]
|
43
|
+
- * # [19, 6.402373705728e+15, 6402373705728000]
|
44
|
+
- * # [20, 1.21645100408832e+17, 121645100408832000]
|
45
|
+
- * # [21, 2.43290200817664e+18, 2432902008176640000]
|
46
|
+
- * # [22, 5.109094217170944e+19, 51090942171709440000]
|
47
|
+
- * # [23, 1.1240007277776077e+21, 1124000727777607680000]
|
48
|
+
- * # [24, 2.5852016738885062e+22, 25852016738884976640000]
|
49
|
+
- * # [25, 6.204484017332391e+23, 620448401733239439360000]
|
50
|
+
- * # [26, 1.5511210043330954e+25, 15511210043330985984000000]
|
51
|
+
+ * produces:
|
52
|
+
+ * [1, 1.0, 1]
|
53
|
+
+ * [2, 1.0, 1]
|
54
|
+
+ * [3, 2.0, 2]
|
55
|
+
+ * [4, 6.0, 6]
|
56
|
+
+ * [5, 24.0, 24]
|
57
|
+
+ * [6, 120.0, 120]
|
58
|
+
+ * [7, 720.0, 720]
|
59
|
+
+ * [8, 5040.0, 5040]
|
60
|
+
+ * [9, 40320.0, 40320]
|
61
|
+
+ * [10, 362880.0, 362880]
|
62
|
+
+ * [11, 3628800.0, 3628800]
|
63
|
+
+ * [12, 39916800.0, 39916800]
|
64
|
+
+ * [13, 479001600.0, 479001600]
|
65
|
+
+ * [14, 6227020800.0, 6227020800]
|
66
|
+
+ * [15, 87178291200.0, 87178291200]
|
67
|
+
+ * [16, 1307674368000.0, 1307674368000]
|
68
|
+
+ * [17, 20922789888000.0, 20922789888000]
|
69
|
+
+ * [18, 355687428096000.0, 355687428096000]
|
70
|
+
+ * [19, 6.402373705728e+15, 6402373705728000]
|
71
|
+
+ * [20, 1.21645100408832e+17, 121645100408832000]
|
72
|
+
+ * [21, 2.43290200817664e+18, 2432902008176640000]
|
73
|
+
+ * [22, 5.109094217170944e+19, 51090942171709440000]
|
74
|
+
+ * [23, 1.1240007277776077e+21, 1124000727777607680000]
|
75
|
+
+ * [24, 2.5852016738885062e+22, 25852016738884976640000]
|
76
|
+
+ * [25, 6.204484017332391e+23, 620448401733239439360000]
|
77
|
+
+ * [26, 1.5511210043330954e+25, 15511210043330985984000000]
|
78
|
+
*
|
79
|
+
*/
|
80
|
+
|
81
|
+
@@ -693,9 +694,17 @@
|
82
|
+
* Calculates the logarithmic gamma of x and
|
83
|
+
* the sign of gamma of x.
|
84
|
+
*
|
85
|
+
- * Math.lgamma(x) is same as
|
86
|
+
- * [Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]
|
87
|
+
- * but avoid overflow by Math.gamma(x) for large x.
|
88
|
+
+ *-- rdx
|
89
|
+
+ * x = rand(100)
|
90
|
+
+ *++
|
91
|
+
+ *
|
92
|
+
+ * If +x+ isn't too large we have that:
|
93
|
+
+ * :rdx: float
|
94
|
+
+ * log_gamma,sgn_gamma = Math.lgamma(x)
|
95
|
+
+ * log_gamma #=> Math.log(Math.gamma(x).abs)
|
96
|
+
+ * sgn_gamma #=> Math.gamma(x) < 0 ? -1 : 1
|
97
|
+
+ * otherwise Math.gamma(x) will overflow (yielding Infinity),
|
98
|
+
+ * while Math.lgamma(x) does not
|
99
|
+
*/
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
@@ -759,7 +768,7 @@
|
103
|
+
*
|
104
|
+
* Math.acos(42)
|
105
|
+
*
|
106
|
+
- * <em>produces:</em>
|
107
|
+
+ * <em>raises the exception:</em>
|
108
|
+
*
|
109
|
+
* Math::DomainError: Numerical argument is out of domain - "acos"
|
110
|
+
*/
|
@@ -0,0 +1,103 @@
|
|
1
|
+
--- core/orig/numeric.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/numeric.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -417,7 +417,12 @@
|
4
|
+
* call-seq:
|
5
|
+
* num.modulo(numeric) -> real
|
6
|
+
*
|
7
|
+
- * x.modulo(y) means x-y*(x/y).floor
|
8
|
+
+ *-- rdx
|
9
|
+
+ * x = (-1)**rand(2) * (1+rand(10)*1.5)
|
10
|
+
+ * y = (-1)**rand(2) * (1+rand(10)*1.5)
|
11
|
+
+ *++
|
12
|
+
+ * The <code>modulo</code> is defined as:
|
13
|
+
+ * x.modulo(y) #=> x-y*(x/y).floor
|
14
|
+
*
|
15
|
+
* Equivalent to
|
16
|
+
* <i>num</i>.<code>divmod(</code><i>aNumeric</i><code>)[1]</code>.
|
17
|
+
@@ -437,7 +442,12 @@
|
18
|
+
* call-seq:
|
19
|
+
* num.remainder(numeric) -> real
|
20
|
+
*
|
21
|
+
- * x.remainder(y) means x-y*(x/y).truncate
|
22
|
+
+ *-- rdx
|
23
|
+
+ * x = (-1)**rand(2) * (1+rand(10)*1.5)
|
24
|
+
+ * y = (-1)**rand(2) * (1+rand(10)*1.5)
|
25
|
+
+ *++
|
26
|
+
+ * The <code>remainder</code> is defined as:
|
27
|
+
+ * x.remainder(y) #=> x-y*(x/y).truncate
|
28
|
+
*
|
29
|
+
* See <code>Numeric#divmod</code>.
|
30
|
+
*/
|
31
|
+
@@ -462,13 +472,20 @@
|
32
|
+
* num.divmod(numeric) -> array
|
33
|
+
*
|
34
|
+
* Returns an array containing the quotient and modulus obtained by
|
35
|
+
- * dividing <i>num</i> by <i>numeric</i>. If <code>q, r =
|
36
|
+
- * x.divmod(y)</code>, then
|
37
|
+
+ * dividing <i>num</i> by <i>numeric</i>.
|
38
|
+
*
|
39
|
+
- * q = floor(x/y)
|
40
|
+
- * x = q*y+r
|
41
|
+
+ *-- rdx
|
42
|
+
+ * x = (-1)**rand(2) * (1+rand(10)*1.5)
|
43
|
+
+ * y = (-1)**rand(2) * (1+rand(10)*1.5)
|
44
|
+
+ *++
|
45
|
+
+ * If
|
46
|
+
+ * q, r = x.divmod(y)
|
47
|
+
+ * then:
|
48
|
+
+ * q #=> (x/y).floor
|
49
|
+
+ * x #=> q*y+r
|
50
|
+
*
|
51
|
+
* The quotient is rounded toward -infinity, as shown in the following table:
|
52
|
+
+ * :rdx: off -
|
53
|
+
*
|
54
|
+
* a | b | a.divmod(b) | a/b | a.modulo(b) | a.remainder(b)
|
55
|
+
* ------+-----+---------------+---------+-------------+---------------
|
56
|
+
@@ -1413,7 +1430,7 @@
|
57
|
+
*
|
58
|
+
* a = -1.0 #=> -1.0
|
59
|
+
* a.nan? #=> false
|
60
|
+
- * a = 0.0/0.0 #=> NaN
|
61
|
+
+ * a = 0.0/0.0 # > NaN
|
62
|
+
* a.nan? #=> true
|
63
|
+
*/
|
64
|
+
|
65
|
+
@@ -1855,6 +1872,7 @@
|
66
|
+
* If no block is given, an enumerator is returned instead.
|
67
|
+
*
|
68
|
+
* 1.step(10, 2) { |i| print i, " " }
|
69
|
+
+ * puts
|
70
|
+
* Math::E.step(Math::PI, 0.2) { |f| print f, " " }
|
71
|
+
*
|
72
|
+
* <em>produces:</em>
|
73
|
+
@@ -2939,7 +2957,7 @@
|
74
|
+
* be negative or fractional.
|
75
|
+
*
|
76
|
+
* 2 ** 3 #=> 8
|
77
|
+
- * 2 ** -1 #=> (1/2)
|
78
|
+
+ * 2 ** -1 #=> 1/2
|
79
|
+
* 2 ** 0.5 #=> 1.4142135623731
|
80
|
+
*/
|
81
|
+
|
82
|
+
@@ -3680,9 +3698,9 @@
|
83
|
+
*
|
84
|
+
* Note that only division by an exact 0 will raise that exception:
|
85
|
+
*
|
86
|
+
- * 42 / 0.0 #=> Float::INFINITY
|
87
|
+
- * 42 / -0.0 #=> -Float::INFINITY
|
88
|
+
- * 0 / 0.0 #=> NaN
|
89
|
+
+ * 42 / 0.0 # > Infinity
|
90
|
+
+ * 42 / -0.0 # > -Infinity
|
91
|
+
+ * 0 / 0.0 # > NaN
|
92
|
+
*/
|
93
|
+
|
94
|
+
/*
|
95
|
+
@@ -3696,7 +3714,7 @@
|
96
|
+
*
|
97
|
+
* <em>raises the exception:</em>
|
98
|
+
*
|
99
|
+
- * FloatDomainError: Infinity
|
100
|
+
+ * FloatDomainError: NaN
|
101
|
+
*/
|
102
|
+
|
103
|
+
void
|
@@ -0,0 +1,295 @@
|
|
1
|
+
--- core/orig/object.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/object.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -88,9 +88,9 @@
|
4
|
+
* obj = "a"
|
5
|
+
* other = obj.dup
|
6
|
+
*
|
7
|
+
- * a == other #=> true
|
8
|
+
- * a.equal? other #=> false
|
9
|
+
- * a.equal? a #=> true
|
10
|
+
+ * obj == other #=> true
|
11
|
+
+ * obj.equal? other #=> false
|
12
|
+
+ * obj.equal? obj #=> true
|
13
|
+
*
|
14
|
+
* The <code>eql?</code> method returns <code>true</code> if +obj+ and
|
15
|
+
* +other+ refer to the same hash key. This is used by Hash to test members
|
16
|
+
@@ -208,8 +208,8 @@
|
17
|
+
* respectively.
|
18
|
+
* If <i>obj</i> is a Fixnum or a Symbol, it raises a TypeError.
|
19
|
+
*
|
20
|
+
- * Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
|
21
|
+
- * String.singleton_class #=> #<Class:String>
|
22
|
+
+ * Object.new.singleton_class # > #<Class:#<Object:0xb7ce1e24>>
|
23
|
+
+ * String.singleton_class # > #<Class:String>
|
24
|
+
* nil.singleton_class #=> NilClass
|
25
|
+
*/
|
26
|
+
|
27
|
+
@@ -280,12 +280,12 @@
|
28
|
+
* class Klass
|
29
|
+
* attr_accessor :str
|
30
|
+
* end
|
31
|
+
- * s1 = Klass.new #=> #<Klass:0x401b3a38>
|
32
|
+
+ * s1 = Klass.new # > #<Klass:0x401b3a38>
|
33
|
+
* s1.str = "Hello" #=> "Hello"
|
34
|
+
- * s2 = s1.clone #=> #<Klass:0x401b3998 @str="Hello">
|
35
|
+
+ * s2 = s1.clone # > #<Klass:0x401b3998 @str="Hello">
|
36
|
+
* s2.str[1,4] = "i" #=> "i"
|
37
|
+
- * s1.inspect #=> "#<Klass:0x401b3a38 @str=\"Hi\">"
|
38
|
+
- * s2.inspect #=> "#<Klass:0x401b3998 @str=\"Hi\">"
|
39
|
+
+ * s1 # > #<Klass:0x401b3a38 @str="Hi">
|
40
|
+
+ * s2 # > #<Klass:0x401b3998 @str="Hi">
|
41
|
+
*
|
42
|
+
* This method may have class-specific behavior. If so, that
|
43
|
+
* behavior will be documented under the #+initialize_copy+ method of
|
44
|
+
@@ -471,25 +471,25 @@
|
45
|
+
* encoding.
|
46
|
+
*
|
47
|
+
* [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]"
|
48
|
+
- * Time.new.inspect #=> "2008-03-08 19:43:39 +0900"
|
49
|
+
+ * Time.new.inspect #-> "2008-03-08 19:43:39 +0900"
|
50
|
+
*
|
51
|
+
* class Foo
|
52
|
+
* end
|
53
|
+
- * Foo.new.inspect #=> "#<Foo:0x0300c868>"
|
54
|
+
+ * Foo.new.inspect # -> "#<Foo:0x0300c868>"
|
55
|
+
*
|
56
|
+
* class Bar
|
57
|
+
* def initialize
|
58
|
+
* @bar = 1
|
59
|
+
* end
|
60
|
+
* end
|
61
|
+
- * Bar.new.inspect #=> "#<Bar:0x0300c868 @bar=1>"
|
62
|
+
+ * Bar.new.inspect # -> "#<Bar:0x0300c868 @bar=1>"
|
63
|
+
*
|
64
|
+
* class Baz
|
65
|
+
* def to_s
|
66
|
+
* "baz"
|
67
|
+
* end
|
68
|
+
* end
|
69
|
+
- * Baz.new.inspect #=> "#<Baz:0x0300c868>"
|
70
|
+
+ * Baz.new.inspect # -> "#<Baz:0x0300c868>"
|
71
|
+
*/
|
72
|
+
|
73
|
+
static VALUE
|
74
|
+
@@ -601,10 +601,18 @@
|
75
|
+
* The primary purpose of this method is to "tap into" a method chain,
|
76
|
+
* in order to perform operations on intermediate results within the chain.
|
77
|
+
*
|
78
|
+
- * (1..10) .tap {|x| puts "original: #{x.inspect}"}
|
79
|
+
- * .to_a .tap {|x| puts "array: #{x.inspect}"}
|
80
|
+
- * .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"}
|
81
|
+
- * .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"}
|
82
|
+
+ * (1..10) .tap {|x| puts "original: #{x.inspect}"}
|
83
|
+
+ * .to_a .tap {|x| puts "array: #{x.inspect}"}
|
84
|
+
+ * .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"}
|
85
|
+
+ * .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"}
|
86
|
+
+ * # => [4, 16, 36, 64, 100]
|
87
|
+
+ *
|
88
|
+
+ * produces:
|
89
|
+
+ *
|
90
|
+
+ * original: 1..10
|
91
|
+
+ * array: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
92
|
+
+ * evens: [2, 4, 6, 8, 10]
|
93
|
+
+ * squares: [4, 16, 36, 64, 100]
|
94
|
+
*
|
95
|
+
*/
|
96
|
+
|
97
|
+
@@ -790,7 +798,7 @@
|
98
|
+
* module Enumerable
|
99
|
+
* include A
|
100
|
+
* end
|
101
|
+
- * # => prints "A included in Enumerable"
|
102
|
+
+ * # prints: A included in Enumerable
|
103
|
+
*/
|
104
|
+
|
105
|
+
/*
|
106
|
+
@@ -809,7 +817,7 @@
|
107
|
+
* module Enumerable
|
108
|
+
* prepend A
|
109
|
+
* end
|
110
|
+
- * # => prints "A prepended to Enumerable"
|
111
|
+
+ * # prints: A prepended to Enumerable
|
112
|
+
*/
|
113
|
+
|
114
|
+
/*
|
115
|
+
@@ -960,10 +968,9 @@
|
116
|
+
* a.freeze
|
117
|
+
* a << "z"
|
118
|
+
*
|
119
|
+
- * <em>produces:</em>
|
120
|
+
+ * <em>raises the exception:</em>
|
121
|
+
*
|
122
|
+
- * prog.rb:3:in `<<': can't modify frozen array (RuntimeError)
|
123
|
+
- * from prog.rb:3
|
124
|
+
+ * can't modify frozen Array (RuntimeError)
|
125
|
+
*/
|
126
|
+
|
127
|
+
VALUE
|
128
|
+
@@ -1058,8 +1065,6 @@
|
129
|
+
}
|
130
|
+
|
131
|
+
/*
|
132
|
+
- * Document-method: to_a
|
133
|
+
- *
|
134
|
+
* call-seq:
|
135
|
+
* nil.to_a -> []
|
136
|
+
*
|
137
|
+
@@ -1075,8 +1080,6 @@
|
138
|
+
}
|
139
|
+
|
140
|
+
/*
|
141
|
+
- * Document-method: to_h
|
142
|
+
- *
|
143
|
+
* call-seq:
|
144
|
+
* nil.to_h -> {}
|
145
|
+
*
|
146
|
+
@@ -1256,7 +1259,7 @@
|
147
|
+
}
|
148
|
+
|
149
|
+
/*
|
150
|
+
- * call_seq:
|
151
|
+
+ * call-seq:
|
152
|
+
* nil.nil? -> true
|
153
|
+
*
|
154
|
+
* Only the object <i>nil</i> responds <code>true</code> to <code>nil?</code>.
|
155
|
+
@@ -1269,7 +1272,7 @@
|
156
|
+
}
|
157
|
+
|
158
|
+
/*
|
159
|
+
- * call_seq:
|
160
|
+
+ * call-seq:
|
161
|
+
* nil.nil? -> true
|
162
|
+
* <anything_else>.nil? -> false
|
163
|
+
*
|
164
|
+
@@ -1352,7 +1355,7 @@
|
165
|
+
* end
|
166
|
+
* end
|
167
|
+
* Mod.class #=> Module
|
168
|
+
- * Mod.constants #=> [:CONST, :PI, :E]
|
169
|
+
+ * Mod.constants #-> [:CONST, :PI, :E]
|
170
|
+
* Mod.instance_methods #=> [:meth]
|
171
|
+
*
|
172
|
+
*/
|
173
|
+
@@ -1628,7 +1631,7 @@
|
174
|
+
* end
|
175
|
+
* end
|
176
|
+
*
|
177
|
+
- * a = fred.new #=> #<#<Class:0x100381890>:0x100376b98>
|
178
|
+
+ * a = fred.new # > #<#<Class:0x100381890>:0x100376b98>
|
179
|
+
* a.meth1 #=> "hello"
|
180
|
+
* a.meth2 #=> "bye"
|
181
|
+
*
|
182
|
+
@@ -1886,8 +1889,9 @@
|
183
|
+
* This method will recursively look up constant names if a namespaced
|
184
|
+
* class name is provided. For example:
|
185
|
+
*
|
186
|
+
- * module Foo; class Bar; end end
|
187
|
+
- * Object.const_get 'Foo::Bar'
|
188
|
+
+ * module Foo; class Bar; class Bat; end end end
|
189
|
+
+ * Foo.const_get 'Bar::Bat' #=> Foo::Bar::Bat
|
190
|
+
+ * :rdx: # we are hiding that Foo isn't Object::Foo
|
191
|
+
*
|
192
|
+
* The +inherit+ flag is respected on each lookup. For example:
|
193
|
+
*
|
194
|
+
@@ -1899,8 +1903,8 @@
|
195
|
+
* class Baz < Bar; end
|
196
|
+
* end
|
197
|
+
*
|
198
|
+
- * Object.const_get 'Foo::Baz::VAL' # => 10
|
199
|
+
- * Object.const_get 'Foo::Baz::VAL', false # => NameError
|
200
|
+
+ * Foo.const_get 'Baz::VAL' # => 10
|
201
|
+
+ * Foo.const_get 'Baz::VAL', false # raises NameError
|
202
|
+
*/
|
203
|
+
|
204
|
+
static VALUE
|
205
|
+
@@ -2035,9 +2039,9 @@
|
206
|
+
*
|
207
|
+
* Returns whether or not a definition is found:
|
208
|
+
*
|
209
|
+
- * Math.const_defined? "PI" #=> true
|
210
|
+
- * IO.const_defined? :SYNC #=> true
|
211
|
+
- * IO.const_defined? :SYNC, false #=> false
|
212
|
+
+ * Math.const_defined? "PI" #=> true
|
213
|
+
+ * File.const_defined? :SEEK_END #=> true # Defined in IO class
|
214
|
+
+ * File.const_defined? :SEEK_END, false #=> false
|
215
|
+
*/
|
216
|
+
|
217
|
+
static VALUE
|
218
|
+
@@ -2127,7 +2131,7 @@
|
219
|
+
* fred = Fred.new('cat', 99)
|
220
|
+
* fred.instance_variable_set(:@a, 'dog') #=> "dog"
|
221
|
+
* fred.instance_variable_set(:@c, 'cat') #=> "cat"
|
222
|
+
- * fred.inspect #=> "#<Fred:0x401b3da8 @a=\"dog\", @b=99, @c=\"cat\">"
|
223
|
+
+ * fred # > #<Fred:0x401b3da8 @a="dog", @b=99, @c="cat">
|
224
|
+
*/
|
225
|
+
|
226
|
+
static VALUE
|
227
|
+
@@ -2474,7 +2478,7 @@
|
228
|
+
*
|
229
|
+
* Integer(123.999) #=> 123
|
230
|
+
* Integer("0x1a") #=> 26
|
231
|
+
- * Integer(Time.new) #=> 1204973019
|
232
|
+
+ * Integer(Time.new) #-> 1204973019
|
233
|
+
* Integer("0930", 10) #=> 930
|
234
|
+
* Integer("111", 2) #=> 7
|
235
|
+
*/
|
236
|
+
@@ -2784,9 +2788,9 @@
|
237
|
+
* <i>arg</i> is <tt>nil</tt> or <tt>[]</tt>.
|
238
|
+
*
|
239
|
+
* Hash([]) #=> {}
|
240
|
+
- * Hash(nil) #=> nil
|
241
|
+
+ * Hash(nil) #=> {}
|
242
|
+
* Hash(key: :value) #=> {:key => :value}
|
243
|
+
- * Hash([1, 2, 3]) #=> TypeError
|
244
|
+
+ * Hash([1, 2, 3]) # raises TypeError
|
245
|
+
*/
|
246
|
+
|
247
|
+
static VALUE
|
248
|
+
@@ -2815,20 +2819,33 @@
|
249
|
+
* This can be demonstrated by overriding <code>new</code> in
|
250
|
+
* <code>Class</code>:
|
251
|
+
*
|
252
|
+
+ * :rdx: toplevel
|
253
|
+
* class Class
|
254
|
+
- * alias oldNew new
|
255
|
+
- * def new(*args)
|
256
|
+
+ * alias old_new new
|
257
|
+
+ * def new(*args,&blk)
|
258
|
+
+ *-- rdx
|
259
|
+
+ * unless self.name =~ /^RDX/ # Don't hook the internals!
|
260
|
+
+ *++
|
261
|
+
* print "Creating a new ", self.name, "\n"
|
262
|
+
- * oldNew(*args)
|
263
|
+
+ *-- rdx
|
264
|
+
+ * end
|
265
|
+
+ *++
|
266
|
+
+ * old_new(*args,&blk)
|
267
|
+
* end
|
268
|
+
* end
|
269
|
+
*
|
270
|
+
- *
|
271
|
+
+ *
|
272
|
+
* class Name
|
273
|
+
* end
|
274
|
+
*
|
275
|
+
- *
|
276
|
+
+ *
|
277
|
+
* n = Name.new
|
278
|
+
+ *-- rdx
|
279
|
+
+ * class Class
|
280
|
+
+ * alias new old_new
|
281
|
+
+ * remove_method :old_new
|
282
|
+
+ * end
|
283
|
+
+ *++
|
284
|
+
*
|
285
|
+
* <em>produces:</em>
|
286
|
+
*
|
287
|
+
@@ -2838,6 +2855,8 @@
|
288
|
+
* that follows, the vertical arrows represent inheritance, and the
|
289
|
+
* parentheses meta-classes. All metaclasses are instances
|
290
|
+
* of the class `Class'.
|
291
|
+
+ *
|
292
|
+
+ * :rdx: off -
|
293
|
+
* +---------+ +-...
|
294
|
+
* | | |
|
295
|
+
* BasicObject-----|-->(BasicObject)-------|-...
|