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,207 @@
|
|
1
|
+
--- core/orig/re.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/re.c 2015-06-20 08:15:30 +0000
|
3
|
+
@@ -1006,7 +1006,7 @@
|
4
|
+
* /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge").names
|
5
|
+
* #=> ["foo", "bar", "baz"]
|
6
|
+
*
|
7
|
+
- * m = /(?<x>.)(?<y>.)?/.match("a") #=> #<MatchData "a" x:"a" y:nil>
|
8
|
+
+ * m = /(?<x>.)(?<y>.)?/.match("a") # > #<MatchData "a" x:"a" y:nil>
|
9
|
+
* m.names #=> ["x", "y"]
|
10
|
+
*/
|
11
|
+
|
12
|
+
@@ -1090,8 +1090,8 @@
|
13
|
+
* m.offset(4) #=> [6, 7]
|
14
|
+
*
|
15
|
+
* m = /(?<foo>.)(.)(?<bar>.)/.match("hoge")
|
16
|
+
- * p m.offset(:foo) #=> [0, 1]
|
17
|
+
- * p m.offset(:bar) #=> [2, 3]
|
18
|
+
+ * m.offset(:foo) #=> [0, 1]
|
19
|
+
+ * m.offset(:bar) #=> [2, 3]
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
|
23
|
+
@@ -1127,8 +1127,8 @@
|
24
|
+
* m.begin(2) #=> 2
|
25
|
+
*
|
26
|
+
* m = /(?<foo>.)(.)(?<bar>.)/.match("hoge")
|
27
|
+
- * p m.begin(:foo) #=> 0
|
28
|
+
- * p m.begin(:bar) #=> 2
|
29
|
+
+ * m.begin(:foo) #=> 0
|
30
|
+
+ * m.begin(:bar) #=> 2
|
31
|
+
*/
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
@@ -1162,8 +1162,8 @@
|
35
|
+
* m.end(2) #=> 3
|
36
|
+
*
|
37
|
+
* m = /(?<foo>.)(.)(?<bar>.)/.match("hoge")
|
38
|
+
- * p m.end(:foo) #=> 1
|
39
|
+
- * p m.end(:bar) #=> 3
|
40
|
+
+ * m.end(:foo) #=> 1
|
41
|
+
+ * m.end(:bar) #=> 3
|
42
|
+
*/
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
@@ -1207,16 +1207,16 @@
|
46
|
+
*
|
47
|
+
* r = /a/u
|
48
|
+
* r.fixed_encoding? #=> true
|
49
|
+
- * r.encoding #=> #<Encoding:UTF-8>
|
50
|
+
+ * r.encoding #=> Encoding::UTF_8
|
51
|
+
* r =~ "\u{6666} a" #=> 2
|
52
|
+
- * r =~ "\xa1\xa2".force_encoding("euc-jp") #=> ArgumentError
|
53
|
+
+ * r =~ "\xa1\xa2".force_encoding("euc-jp") # raises Encoding::CompatibilityError
|
54
|
+
* r =~ "abc".force_encoding("euc-jp") #=> 0
|
55
|
+
*
|
56
|
+
* r = /\u{6666}/
|
57
|
+
* r.fixed_encoding? #=> true
|
58
|
+
- * r.encoding #=> #<Encoding:UTF-8>
|
59
|
+
+ * r.encoding #=> Encoding::UTF_8
|
60
|
+
* r =~ "\u{6666} a" #=> 0
|
61
|
+
- * r =~ "\xa1\xa2".force_encoding("euc-jp") #=> ArgumentError
|
62
|
+
+ * r =~ "\xa1\xa2".force_encoding("euc-jp") # raises Encoding::CompatibilityError
|
63
|
+
* r =~ "abc".force_encoding("euc-jp") #=> nil
|
64
|
+
*/
|
65
|
+
|
66
|
+
@@ -1696,14 +1696,14 @@
|
67
|
+
* pattern between parentheses).
|
68
|
+
*
|
69
|
+
* m = /(.)(.)(\d+)(\d)/.match("THX1138.")
|
70
|
+
- * m #=> #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
|
71
|
+
+ * m # > #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
|
72
|
+
* m[0] #=> "HX1138"
|
73
|
+
* m[1, 2] #=> ["H", "X"]
|
74
|
+
* m[1..3] #=> ["H", "X", "113"]
|
75
|
+
* m[-3, 2] #=> ["X", "113"]
|
76
|
+
*
|
77
|
+
* m = /(?<foo>a+)b/.match("ccaaab")
|
78
|
+
- * m #=> #<MatchData "aaab" foo:"aaa">
|
79
|
+
+ * m # > #<MatchData "aaab" foo:"aaa">
|
80
|
+
* m["foo"] #=> "aaa"
|
81
|
+
* m[:foo] #=> "aaa"
|
82
|
+
*/
|
83
|
+
@@ -1846,17 +1846,17 @@
|
84
|
+
*
|
85
|
+
* Returns a printable version of <i>mtch</i>.
|
86
|
+
*
|
87
|
+
- * puts /.$/.match("foo").inspect
|
88
|
+
- * #=> #<MatchData "o">
|
89
|
+
+ * /.$/.match("foo").inspect
|
90
|
+
+ * #=> '#<MatchData "o">'
|
91
|
+
*
|
92
|
+
- * puts /(.)(.)(.)/.match("foo").inspect
|
93
|
+
- * #=> #<MatchData "foo" 1:"f" 2:"o" 3:"o">
|
94
|
+
+ * /(.)(.)(.)/.match("foo").inspect
|
95
|
+
+ * #=> '#<MatchData "foo" 1:"f" 2:"o" 3:"o">'
|
96
|
+
*
|
97
|
+
- * puts /(.)(.)?(.)/.match("fo").inspect
|
98
|
+
- * #=> #<MatchData "fo" 1:"f" 2:nil 3:"o">
|
99
|
+
+ * /(.)(.)?(.)/.match("fo").inspect
|
100
|
+
+ * #=> '#<MatchData "fo" 1:"f" 2:nil 3:"o">'
|
101
|
+
*
|
102
|
+
- * puts /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge").inspect
|
103
|
+
- * #=> #<MatchData "hog" foo:"h" bar:"o" baz:"g">
|
104
|
+
+ * /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge").inspect
|
105
|
+
+ * #=> '#<MatchData "hog" foo:"h" bar:"o" baz:"g">'
|
106
|
+
*
|
107
|
+
*/
|
108
|
+
|
109
|
+
@@ -2708,37 +2708,39 @@
|
110
|
+
* the capture names.
|
111
|
+
*
|
112
|
+
* /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ " x = y "
|
113
|
+
- * p lhs #=> "x"
|
114
|
+
- * p rhs #=> "y"
|
115
|
+
+ * lhs #=> "x"
|
116
|
+
+ * rhs #=> "y"
|
117
|
+
*
|
118
|
+
* If it is not matched, nil is assigned for the variables.
|
119
|
+
*
|
120
|
+
* /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ " x = "
|
121
|
+
- * p lhs #=> nil
|
122
|
+
- * p rhs #=> nil
|
123
|
+
+ * lhs #=> nil
|
124
|
+
+ * rhs #=> nil
|
125
|
+
*
|
126
|
+
* This assignment is implemented in the Ruby parser.
|
127
|
+
* The parser detects 'regexp-literal =~ expression' for the assignment.
|
128
|
+
* The regexp must be a literal without interpolation and placed at left hand side.
|
129
|
+
*
|
130
|
+
+ * :rdx: new_binding
|
131
|
+
* The assignment does not occur if the regexp is not a literal.
|
132
|
+
*
|
133
|
+
* re = /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/
|
134
|
+
* re =~ " x = y "
|
135
|
+
- * p lhs # undefined local variable
|
136
|
+
- * p rhs # undefined local variable
|
137
|
+
+ * lhs # raises NameError: undefined local variable
|
138
|
+
+ * rhs # raises NameError: undefined local variable
|
139
|
+
*
|
140
|
+
* A regexp interpolation, <code>#{}</code>, also disables
|
141
|
+
* the assignment.
|
142
|
+
*
|
143
|
+
* rhs_pat = /(?<rhs>\w+)/
|
144
|
+
* /(?<lhs>\w+)\s*=\s*#{rhs_pat}/ =~ "x = y"
|
145
|
+
- * p lhs # undefined local variable
|
146
|
+
+ * lhs # raises NameError: undefined local variable
|
147
|
+
*
|
148
|
+
* The assignment does not occur if the regexp is placed at the right hand side.
|
149
|
+
*
|
150
|
+
* " x = y " =~ /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/
|
151
|
+
- * p lhs, rhs # undefined local variable
|
152
|
+
+ * lhs # raises NameError: undefined local variable
|
153
|
+
+ * rhs # raises NameError: undefined local variable
|
154
|
+
*
|
155
|
+
*/
|
156
|
+
|
157
|
+
@@ -2763,13 +2765,13 @@
|
158
|
+
* when /^[A-Z]*$/; print "Upper case\n"
|
159
|
+
* else; print "Mixed case\n"
|
160
|
+
* end
|
161
|
+
- * #=> "Upper case"
|
162
|
+
+ * # prints Upper case
|
163
|
+
*
|
164
|
+
* Following a regular expression literal with the #=== operator allows you to
|
165
|
+
* compare against a String.
|
166
|
+
*
|
167
|
+
- * /^[a-z]*$/ === "HELLO" #=> false
|
168
|
+
- * /^[A-Z]*$/ === "HELLO" #=> true
|
169
|
+
+ * /^[a-z]*$/ === "HELLO" #=> false
|
170
|
+
+ * /^[A-Z]*$/ === "HELLO" #=> true
|
171
|
+
*/
|
172
|
+
|
173
|
+
VALUE
|
174
|
+
@@ -2838,6 +2840,8 @@
|
175
|
+
* If a block is given, invoke the block with MatchData if match succeed, so
|
176
|
+
* that you can write
|
177
|
+
*
|
178
|
+
+ * :rdx: off
|
179
|
+
+ *
|
180
|
+
* pat.match(str) {|m| ...}
|
181
|
+
*
|
182
|
+
* instead of
|
183
|
+
@@ -3069,7 +3073,7 @@
|
184
|
+
* escaped. For any string,
|
185
|
+
* <code>Regexp.new(Regexp.escape(<i>str</i>))=~<i>str</i></code> will be true.
|
186
|
+
*
|
187
|
+
- * Regexp.escape('\*?{}.') #=> \\\*\?\{\}\.
|
188
|
+
+ * puts Regexp.escape('\*?{}.') # prints: \\\*\?\{\}\.
|
189
|
+
*
|
190
|
+
*/
|
191
|
+
|
192
|
+
@@ -3463,13 +3467,13 @@
|
193
|
+
* method that did the pattern match.
|
194
|
+
*
|
195
|
+
* /c(.)t/ =~ 'cat' #=> 0
|
196
|
+
- * Regexp.last_match #=> #<MatchData "cat" 1:"a">
|
197
|
+
+ * Regexp.last_match # > #<MatchData "cat" 1:"a">
|
198
|
+
* Regexp.last_match(0) #=> "cat"
|
199
|
+
* Regexp.last_match(1) #=> "a"
|
200
|
+
* Regexp.last_match(2) #=> nil
|
201
|
+
*
|
202
|
+
* /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ "var = val"
|
203
|
+
- * Regexp.last_match #=> #<MatchData "var = val" lhs:"var" rhs:"val">
|
204
|
+
+ * Regexp.last_match # > #<MatchData "var = val" lhs:"var" rhs:"val">
|
205
|
+
* Regexp.last_match(:lhs) #=> "var"
|
206
|
+
* Regexp.last_match(:rhs) #=> "val"
|
207
|
+
*/
|
@@ -0,0 +1,21 @@
|
|
1
|
+
--- core/orig/ruby.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/ruby.c 2015-06-20 08:17:17 +0000
|
3
|
+
@@ -1713,12 +1713,12 @@
|
4
|
+
/*
|
5
|
+
* DATA is a File that contains the data section of the executed file.
|
6
|
+
* To create a data section use <tt>__END__</tt>:
|
7
|
+
- *
|
8
|
+
- * $ cat t.rb
|
9
|
+
- * puts DATA.gets
|
10
|
+
- * __END__
|
11
|
+
- * hello world!
|
12
|
+
- *
|
13
|
+
+ *
|
14
|
+
+ * $ cat > t.rb <<EOS
|
15
|
+
+ * > puts DATA.gets
|
16
|
+
+ * > __END__
|
17
|
+
+ * > hello world!
|
18
|
+
+ * > EOS
|
19
|
+
* $ ruby t.rb
|
20
|
+
* hello world!
|
21
|
+
*/
|
@@ -0,0 +1,67 @@
|
|
1
|
+
--- core/orig/signal.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/signal.c 2015-06-20 08:21:43 +0000
|
3
|
+
@@ -219,11 +219,14 @@
|
4
|
+
*
|
5
|
+
* convert signal number to signal name
|
6
|
+
*
|
7
|
+
+ * # File: prog.rb
|
8
|
+
* Signal.trap("INT") { |signo| puts Signal.signame(signo) }
|
9
|
+
- * Process.kill("INT", 0)
|
10
|
+
+ * Process.kill("INT", Process.pid)
|
11
|
+
*
|
12
|
+
- * <em>produces:</em>
|
13
|
+
+ * Then from command line:
|
14
|
+
+ * :rdx: if Signal.list["INT"]
|
15
|
+
*
|
16
|
+
+ * $ ruby prog.rb
|
17
|
+
* INT
|
18
|
+
*/
|
19
|
+
static VALUE
|
20
|
+
@@ -957,6 +960,8 @@
|
21
|
+
* invoked just prior to program termination.
|
22
|
+
* trap returns the previous handler for the given signal.
|
23
|
+
*
|
24
|
+
+ * :rdx: if Process.respond_to?(:fork) && Signal.list["CLD"]
|
25
|
+
+ *
|
26
|
+
* Signal.trap(0, proc { puts "Terminating: #{$$}" })
|
27
|
+
* Signal.trap("CLD") { puts "Child died" }
|
28
|
+
* fork && Process.wait
|
29
|
+
@@ -1008,7 +1013,16 @@
|
30
|
+
* Returns a list of signal names mapped to the corresponding
|
31
|
+
* underlying signal numbers.
|
32
|
+
*
|
33
|
+
- * Signal.list #=> {"EXIT"=>0, "HUP"=>1, "INT"=>2, "QUIT"=>3, "ILL"=>4, "TRAP"=>5, "IOT"=>6, "ABRT"=>6, "FPE"=>8, "KILL"=>9, "BUS"=>7, "SEGV"=>11, "SYS"=>31, "PIPE"=>13, "ALRM"=>14, "TERM"=>15, "URG"=>23, "STOP"=>19, "TSTP"=>20, "CONT"=>18, "CHLD"=>17, "CLD"=>17, "TTIN"=>21, "TTOU"=>22, "IO"=>29, "XCPU"=>24, "XFSZ"=>25, "VTALRM"=>26, "PROF"=>27, "WINCH"=>28, "USR1"=>10, "USR2"=>12, "PWR"=>30, "POLL"=>29}
|
34
|
+
+ * Signal.list
|
35
|
+
+ * # -> {
|
36
|
+
+ * # "EXIT" => 0, "HUP" => 1, "INT" => 2, "QUIT" => 3, "ILL" => 4,
|
37
|
+
+ * # "TRAP" => 5, "IOT" => 6, "ABRT" => 6, "BUS" => 7, "FPE" => 8,
|
38
|
+
+ * # "KILL" => 9, "USR1" => 10, "SEGV" => 11, "USR2" => 12, "PIPE" => 13,
|
39
|
+
+ * # "ALRM" => 14, "TERM" => 15, "CHLD" => 17, "CLD" => 17, "CONT" => 18,
|
40
|
+
+ * # "STOP" => 19, "TSTP" => 20, "TTIN" => 21, "TTOU" => 22, "URG" => 23,
|
41
|
+
+ * # "XCPU" => 24, "XFSZ" => 25, "VTALRM"=>26, "PROF" => 27, "WINCH"=> 28,
|
42
|
+
+ * # "IO" => 29, "POLL" => 29, "PWR" => 30, "SYS" => 31
|
43
|
+
+ * # }
|
44
|
+
*/
|
45
|
+
static VALUE
|
46
|
+
sig_list(void)
|
47
|
+
@@ -1078,6 +1092,11 @@
|
48
|
+
* example, your process may trap the USR1 signal and use it to toggle
|
49
|
+
* debugging, and may use TERM to initiate a controlled shutdown.
|
50
|
+
*
|
51
|
+
+ * :rdx: if Process.respond_to?(:fork) && Signal.list['USR1'] && Signal.list['TERM']
|
52
|
+
+ *
|
53
|
+
+ *-- rdx
|
54
|
+
+ * def shutdown; end
|
55
|
+
+ *++
|
56
|
+
* pid = fork do
|
57
|
+
* Signal.trap("USR1") do
|
58
|
+
* $debug = !$debug
|
59
|
+
@@ -1102,7 +1121,7 @@
|
60
|
+
* produces:
|
61
|
+
* Debug now: true
|
62
|
+
* Debug now: false
|
63
|
+
- * Terminating...
|
64
|
+
+ * Terminating...
|
65
|
+
*
|
66
|
+
* The list of available signal names and their interpretation is
|
67
|
+
* system dependent. Signal delivery semantics may also vary between
|
@@ -0,0 +1,29 @@
|
|
1
|
+
--- core/orig/sprintf.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/sprintf.c 2015-06-20 08:22:18 +0000
|
3
|
+
@@ -178,7 +178,8 @@
|
4
|
+
* other than format sequences are copied to the result.
|
5
|
+
*
|
6
|
+
* The syntax of a format sequence is follows.
|
7
|
+
- *
|
8
|
+
+ *
|
9
|
+
+ * :rdx: off
|
10
|
+
* %[flags][width][.precision]type
|
11
|
+
*
|
12
|
+
* A format
|
13
|
+
@@ -287,6 +288,7 @@
|
14
|
+
* | | sign, use the indicated argument as the width.
|
15
|
+
*
|
16
|
+
* Examples of flags:
|
17
|
+
+ * :rdx: on
|
18
|
+
*
|
19
|
+
* # `+' and space flag specifies the sign of non-negative numbers.
|
20
|
+
* sprintf("%d", 123) #=> "123"
|
21
|
+
@@ -424,7 +426,7 @@
|
22
|
+
*
|
23
|
+
* Exapmles:
|
24
|
+
* sprintf("%<foo>d : %<bar>f", { :foo => 1, :bar => 2 })
|
25
|
+
- * #=> 1 : 2.000000
|
26
|
+
+ * #=> "1 : 2.000000"
|
27
|
+
* sprintf("%{foo}f", { :foo => 1 })
|
28
|
+
* # => "1f"
|
29
|
+
*/
|
@@ -0,0 +1,73 @@
|
|
1
|
+
--- core/orig/string.c 2015-06-11 07:51:43 +0000
|
2
|
+
+++ core/patched/string.c 2015-06-20 08:27:22 +0000
|
3
|
+
@@ -1289,7 +1289,7 @@
|
4
|
+
* details of the format string.
|
5
|
+
*
|
6
|
+
* "%05d" % 123 #=> "00123"
|
7
|
+
- * "%-5s: %08x" % [ "ID", self.object_id ] #=> "ID : 200e14d6"
|
8
|
+
+ * "%-5s: %08x" % [ "ID", 0x2b45 ] #=> "ID : 00002b45"
|
9
|
+
* "foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar"
|
10
|
+
*/
|
11
|
+
|
12
|
+
@@ -2752,13 +2752,14 @@
|
13
|
+
* parameter is present, it specifies the position in the string to begin the
|
14
|
+
* search.
|
15
|
+
*
|
16
|
+
- * 'hello'.match('(.)\1') #=> #<MatchData "ll" 1:"l">
|
17
|
+
+ * 'hello'.match('(.)\1') # > #<MatchData "ll" 1:"l">
|
18
|
+
* 'hello'.match('(.)\1')[0] #=> "ll"
|
19
|
+
* 'hello'.match(/(.)\1/)[0] #=> "ll"
|
20
|
+
* 'hello'.match('xx') #=> nil
|
21
|
+
*
|
22
|
+
* If a block is given, invoke the block with MatchData if match succeed, so
|
23
|
+
* that you can write
|
24
|
+
+ * :rdx: off
|
25
|
+
*
|
26
|
+
* str.match(pat) {|m| ...}
|
27
|
+
*
|
28
|
+
@@ -3057,6 +3058,7 @@
|
29
|
+
* If no block is given, an enumerator is returned instead.
|
30
|
+
*
|
31
|
+
* "a8".upto("b6") {|s| print s, ' ' }
|
32
|
+
+ * puts
|
33
|
+
* for s in "a8".."b6"
|
34
|
+
* print s, ' '
|
35
|
+
* end
|
36
|
+
@@ -3791,7 +3793,8 @@
|
37
|
+
* "hello".sub(/([aeiou])/, '<\1>') #=> "h<e>llo"
|
38
|
+
* "hello".sub(/./) {|s| s.ord.to_s + ' ' } #=> "104 ello"
|
39
|
+
* "hello".sub(/(?<foo>[aeiou])/, '*\k<foo>*') #=> "h*e*llo"
|
40
|
+
- * 'Is SHELL your preferred shell?'.sub(/[[:upper:]]{2,}/, ENV)
|
41
|
+
+ * env = { 'SHELL' => '/bin/bash' }
|
42
|
+
+ * 'Is SHELL your preferred shell?'.sub(/[[:upper:]]{2,}/, env)
|
43
|
+
* #=> "Is /bin/bash your preferred shell?"
|
44
|
+
*/
|
45
|
+
|
46
|
+
@@ -4576,7 +4579,7 @@
|
47
|
+
* Produces a version of +str+ with all non-printing characters replaced by
|
48
|
+
* <code>\nnn</code> notation and all special characters escaped.
|
49
|
+
*
|
50
|
+
- * "hello \n ''".dump #=> "\"hello \\n ''\"
|
51
|
+
+ * "hello \n ''".dump #=> "\"hello \\n ''\""
|
52
|
+
*/
|
53
|
+
|
54
|
+
VALUE
|
55
|
+
@@ -7722,10 +7725,14 @@
|
56
|
+
* def Fred()
|
57
|
+
* end
|
58
|
+
* $f3 = :Fred
|
59
|
+
- * $f1.object_id #=> 2514190
|
60
|
+
- * $f2.object_id #=> 2514190
|
61
|
+
- * $f3.object_id #=> 2514190
|
62
|
+
- *
|
63
|
+
+ * id_1 = $f1.object_id #-> 2514190
|
64
|
+
+ * id_2 = $f2.object_id #-> 2514190
|
65
|
+
+ * id_3 = $f3.object_id #-> 2514190
|
66
|
+
+ * (id_1 == id_2) && (id_2 == id_3) #=> true
|
67
|
+
+ *-- rdx
|
68
|
+
+ * $f1 = $f2 = $f3 = nil
|
69
|
+
+ *++
|
70
|
+
+ *
|
71
|
+
*/
|
72
|
+
|
73
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
--- core/orig/struct.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/struct.c 2015-06-11 07:51:47 +0000
|
3
|
+
@@ -319,11 +319,15 @@
|
4
|
+
*
|
5
|
+
* # Create a structure with a name in Struct
|
6
|
+
* Struct.new("Customer", :name, :address) #=> Struct::Customer
|
7
|
+
- * Struct::Customer.new("Dave", "123 Main") #=> #<struct Struct::Customer name="Dave", address="123 Main">
|
8
|
+
+ * Struct::Customer.new("Dave", "123 Main") # > #<struct Struct::Customer name="Dave", address="123 Main">
|
9
|
+
*
|
10
|
+
+ * :rdx: toplevel
|
11
|
+
* # Create a structure named by its constant
|
12
|
+
* Customer = Struct.new(:name, :address) #=> Customer
|
13
|
+
- * Customer.new("Dave", "123 Main") #=> #<struct Customer name="Dave", address="123 Main">
|
14
|
+
+ * Customer.new("Dave", "123 Main") # > #<struct Customer name="Dave", address="123 Main">
|
15
|
+
+ *-- rdx
|
16
|
+
+ * Object.send :remove_const, :Customer
|
17
|
+
+ *++
|
18
|
+
*/
|
19
|
+
|
20
|
+
static VALUE
|
@@ -0,0 +1,691 @@
|
|
1
|
+
--- core/orig/time.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/time.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -2241,13 +2241,13 @@
|
4
|
+
* +utc_offset+ is the offset from UTC.
|
5
|
+
* It can be a string such as "+09:00" or a number of seconds such as 32400.
|
6
|
+
*
|
7
|
+
- * a = Time.new #=> 2007-11-19 07:50:02 -0600
|
8
|
+
- * b = Time.new #=> 2007-11-19 07:50:02 -0600
|
9
|
+
- * a == b #=> false
|
10
|
+
- * "%.6f" % a.to_f #=> "1195480202.282373"
|
11
|
+
- * "%.6f" % b.to_f #=> "1195480202.283415"
|
12
|
+
+ * a = Time.new # 2007-11-19 07:50:02 -0600
|
13
|
+
+ * b = Time.new # 2007-11-19 07:50:02 -0600
|
14
|
+
+ * a == b #-> false
|
15
|
+
+ * "%.6f" % a.to_f #-> "1195480202.282373"
|
16
|
+
+ * "%.6f" % b.to_f #-> "1195480202.283415"
|
17
|
+
*
|
18
|
+
- * Time.new(2008,6,21, 13,30,0, "+09:00") #=> 2008-06-21 13:30:00 +0900
|
19
|
+
+ * Time.new(2008,6,21, 13,30,0, "+09:00") # > 2008-06-21 13:30:00 +0900
|
20
|
+
*
|
21
|
+
* # A trip for RubyConf 2007
|
22
|
+
* t1 = Time.new(2007,11,1,15,25,0, "+09:00") # JST (Narita)
|
23
|
+
@@ -2258,10 +2258,10 @@
|
24
|
+
* t6 = Time.new(2007,11,5,11,21,0, "-05:00") # EST (Detroit)
|
25
|
+
* t7 = Time.new(2007,11,5,13,45,0, "-05:00") # EST (Detroit)
|
26
|
+
* t8 = Time.new(2007,11,6,17,10,0, "+09:00") # JST (Narita)
|
27
|
+
- * p((t2-t1)/3600.0) #=> 10.666666666666666
|
28
|
+
- * p((t4-t3)/3600.0) #=> 2.466666666666667
|
29
|
+
- * p((t6-t5)/3600.0) #=> 1.95
|
30
|
+
- * p((t8-t7)/3600.0) #=> 13.416666666666666
|
31
|
+
+ * (t2-t1)/3600.0 #=> 10.666666666666666
|
32
|
+
+ * (t4-t3)/3600.0 #=> 2.466666666666667
|
33
|
+
+ * (t6-t5)/3600.0 #=> 1.95
|
34
|
+
+ * (t8-t7)/3600.0 #=> 13.416666666666666
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
|
38
|
+
@@ -2497,7 +2497,7 @@
|
39
|
+
*
|
40
|
+
* Creates a new Time object for the current time.
|
41
|
+
*
|
42
|
+
- * Time.now #=> 2009-06-24 12:39:54 +0900
|
43
|
+
+ * Time.now # 2009-06-24 12:39:54 +0900
|
44
|
+
*/
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
@@ -2521,10 +2521,11 @@
|
48
|
+
*
|
49
|
+
* If a numeric argument is given, the result is in local time.
|
50
|
+
*
|
51
|
+
- * Time.at(0) #=> 1969-12-31 18:00:00 -0600
|
52
|
+
- * Time.at(Time.at(0)) #=> 1969-12-31 18:00:00 -0600
|
53
|
+
- * Time.at(946702800) #=> 1999-12-31 23:00:00 -0600
|
54
|
+
- * Time.at(-284061600) #=> 1960-12-31 00:00:00 -0600
|
55
|
+
+ * Time.at(0) # => Time.utc(1970).getlocal
|
56
|
+
+ * # something like: 1969-12-31 18:00:00 -0600
|
57
|
+
+ * Time.at(Time.at(0)) # 1969-12-31 18:00:00 -0600
|
58
|
+
+ * Time.at(946702800) # 1999-12-31 23:00:00 -0600
|
59
|
+
+ * Time.at(-284061600) # 1960-12-31 00:00:00 -0600
|
60
|
+
* Time.at(946684800.2).usec #=> 200000
|
61
|
+
* Time.at(946684800, 123456.789).nsec #=> 123456789
|
62
|
+
*/
|
63
|
+
@@ -3135,8 +3136,8 @@
|
64
|
+
*
|
65
|
+
* +sec_with_frac+ and +usec_with_frac+ can have a fractional part.
|
66
|
+
*
|
67
|
+
- * Time.utc(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
68
|
+
- * Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
69
|
+
+ * Time.utc(2000,"jan",1,20,15,1) # > 2000-01-01 20:15:01 UTC
|
70
|
+
+ * Time.gm(2000,"jan",1,20,15,1) # > 2000-01-01 20:15:01 UTC
|
71
|
+
*/
|
72
|
+
static VALUE
|
73
|
+
time_s_mkutc(int argc, VALUE *argv, VALUE klass)
|
74
|
+
@@ -3166,7 +3167,7 @@
|
75
|
+
* Same as Time::gm, but interprets the values in the
|
76
|
+
* local time zone.
|
77
|
+
*
|
78
|
+
- * Time.local(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 -0600
|
79
|
+
+ * Time.local(2000,"jan",1,20,15,1) # 2000-01-01 20:15:01 -0600
|
80
|
+
*/
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
@@ -3184,8 +3185,8 @@
|
84
|
+
* since the Epoch.
|
85
|
+
*
|
86
|
+
* t = Time.now
|
87
|
+
- * "%10.5f" % t.to_f #=> "1270968656.89607"
|
88
|
+
- * t.to_i #=> 1270968656
|
89
|
+
+ * "%10.5f" % t.to_f #-> "1270968656.89607"
|
90
|
+
+ * t.to_i #-> 1270968656
|
91
|
+
*/
|
92
|
+
|
93
|
+
static VALUE
|
94
|
+
@@ -3205,8 +3206,8 @@
|
95
|
+
* seconds since the Epoch.
|
96
|
+
*
|
97
|
+
* t = Time.now
|
98
|
+
- * "%10.5f" % t.to_f #=> "1270968744.77658"
|
99
|
+
- * t.to_i #=> 1270968744
|
100
|
+
+ * "%10.5f" % t.to_f #-> "1270968744.77658"
|
101
|
+
+ * t.to_i #-> 1270968744
|
102
|
+
*
|
103
|
+
* Note that IEEE 754 double is not accurate enough to represent
|
104
|
+
* the number of nanoseconds since the Epoch.
|
105
|
+
@@ -3228,8 +3229,8 @@
|
106
|
+
* Returns the value of _time_ as a rational number of seconds
|
107
|
+
* since the Epoch.
|
108
|
+
*
|
109
|
+
- * t = Time.now
|
110
|
+
- * p t.to_r #=> (1270968792716287611/1000000000)
|
111
|
+
+ * t = Time.at(15)
|
112
|
+
+ * t.to_r #=> 15/1
|
113
|
+
*
|
114
|
+
* This methods is intended to be used to get an accurate value
|
115
|
+
* representing the nanoseconds since the Epoch. You can use this method
|
116
|
+
@@ -3257,9 +3258,9 @@
|
117
|
+
*
|
118
|
+
* Returns the number of microseconds for _time_.
|
119
|
+
*
|
120
|
+
- * t = Time.now #=> 2007-11-19 08:03:26 -0600
|
121
|
+
- * "%10.6f" % t.to_f #=> "1195481006.775195"
|
122
|
+
- * t.usec #=> 775195
|
123
|
+
+ * t = Time.now
|
124
|
+
+ * "%10.6f" % t.to_f #-> "1195481006.775195"
|
125
|
+
+ * t.usec #-> 775195
|
126
|
+
*/
|
127
|
+
|
128
|
+
static VALUE
|
129
|
+
@@ -3282,9 +3283,9 @@
|
130
|
+
*
|
131
|
+
* Returns the number of nanoseconds for _time_.
|
132
|
+
*
|
133
|
+
- * t = Time.now #=> 2007-11-17 15:18:03 +0900
|
134
|
+
- * "%10.9f" % t.to_f #=> "1195280283.536151409"
|
135
|
+
- * t.nsec #=> 536151406
|
136
|
+
+ * t = Time.now
|
137
|
+
+ * "%10.9f" % t.to_f #-> "1195280283.536151409"
|
138
|
+
+ * t.nsec #-> 536151406
|
139
|
+
*
|
140
|
+
* The lowest digits of #to_f and #nsec are different because
|
141
|
+
* IEEE 754 double is not accurate enough to represent
|
142
|
+
@@ -3310,9 +3311,9 @@
|
143
|
+
*
|
144
|
+
* The return value can be a rational number.
|
145
|
+
*
|
146
|
+
- * t = Time.now #=> 2009-03-26 22:33:12 +0900
|
147
|
+
- * "%10.9f" % t.to_f #=> "1238074392.940563917"
|
148
|
+
- * t.subsec #=> (94056401/100000000)
|
149
|
+
+ * t = Time.now
|
150
|
+
+ * "%10.9f" % t.to_f #-> "1238074392.940563917"
|
151
|
+
+ * t.subsec # 94056401/100000000
|
152
|
+
*
|
153
|
+
* The lowest digits of #to_f and #subsec are different because
|
154
|
+
* IEEE 754 double is not accurate enough to represent
|
155
|
+
@@ -3339,15 +3340,15 @@
|
156
|
+
* +other_time+, +0+ if _time_ is equal to +other_time+ and
|
157
|
+
* +-1+ if _time_ is smaller than +other_time+.
|
158
|
+
*
|
159
|
+
- * t = Time.now #=> 2007-11-19 08:12:12 -0600
|
160
|
+
- * t2 = t + 2592000 #=> 2007-12-19 08:12:12 -0600
|
161
|
+
+ * t = Time.now
|
162
|
+
+ * t2 = t + 2592000
|
163
|
+
* t <=> t2 #=> -1
|
164
|
+
- * t2 <=> t #=> 1
|
165
|
+
+ * t2 <=> t #=> +1
|
166
|
+
*
|
167
|
+
- * t = Time.now #=> 2007-11-19 08:13:38 -0600
|
168
|
+
- * t2 = t + 0.1 #=> 2007-11-19 08:13:38 -0600
|
169
|
+
- * t.nsec #=> 98222999
|
170
|
+
- * t2.nsec #=> 198222999
|
171
|
+
+ * t = Time.now # 2007-11-19 08:13:38 -0600
|
172
|
+
+ * t2 = t + 0.1 # 2007-11-19 08:13:38 -0600
|
173
|
+
+ * t.nsec #-> 98222999
|
174
|
+
+ * t2.nsec #-> 198222999
|
175
|
+
* t <=> t2 #=> -1
|
176
|
+
* t2 <=> t #=> 1
|
177
|
+
* t <=> t #=> 0
|
178
|
+
@@ -3400,14 +3401,14 @@
|
179
|
+
*
|
180
|
+
* Returns +true+ if _time_ represents a time in UTC (GMT).
|
181
|
+
*
|
182
|
+
- * t = Time.now #=> 2007-11-19 08:15:23 -0600
|
183
|
+
+ * t = Time.now # 2007-11-19 08:15:23 -0600
|
184
|
+
* t.utc? #=> false
|
185
|
+
- * t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
186
|
+
+ * t = Time.gm(2000,"jan",1,20,15,1) # > 2000-01-01 20:15:01 UTC
|
187
|
+
* t.utc? #=> true
|
188
|
+
- *
|
189
|
+
- * t = Time.now #=> 2007-11-19 08:16:03 -0600
|
190
|
+
+ *
|
191
|
+
+ * t = Time.now # 2007-11-19 08:16:03 -0600
|
192
|
+
* t.gmt? #=> false
|
193
|
+
- * t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
194
|
+
+ * t = Time.gm(2000,1,1,20,15,1) # > 2000-01-01 20:15:01 UTC
|
195
|
+
* t.gmt? #=> true
|
196
|
+
*/
|
197
|
+
|
198
|
+
@@ -3493,14 +3494,14 @@
|
199
|
+
*
|
200
|
+
* If +utc_offset+ is given, it is used instead of the local time.
|
201
|
+
*
|
202
|
+
- * t = Time.utc(2000, "jan", 1, 20, 15, 1) #=> 2000-01-01 20:15:01 UTC
|
203
|
+
- * t.utc? #=> true
|
204
|
+
+ * t = Time.utc(2000, "jan", 1, 20, 15, 1) # > 2000-01-01 20:15:01 UTC
|
205
|
+
+ * t.utc? #=> true
|
206
|
+
*
|
207
|
+
- * t.localtime #=> 2000-01-01 14:15:01 -0600
|
208
|
+
- * t.utc? #=> false
|
209
|
+
+ * t.localtime # 2000-01-01 14:15:01 -0600
|
210
|
+
+ * t.utc? #=> false
|
211
|
+
*
|
212
|
+
- * t.localtime("+09:00") #=> 2000-01-02 05:15:01 +0900
|
213
|
+
- * t.utc? #=> false
|
214
|
+
+ * t.localtime("+09:00") # > 2000-01-02 05:15:01 +0900
|
215
|
+
+ * t.utc? #=> false
|
216
|
+
*/
|
217
|
+
|
218
|
+
static VALUE
|
219
|
+
@@ -3527,14 +3528,14 @@
|
220
|
+
*
|
221
|
+
* Converts _time_ to UTC (GMT), modifying the receiver.
|
222
|
+
*
|
223
|
+
- * t = Time.now #=> 2007-11-19 08:18:31 -0600
|
224
|
+
+ * t = Time.now # 2007-11-19 08:18:31 -0600
|
225
|
+
* t.gmt? #=> false
|
226
|
+
- * t.gmtime #=> 2007-11-19 14:18:31 UTC
|
227
|
+
+ * t.gmtime # 2007-11-19 14:18:31 UTC
|
228
|
+
* t.gmt? #=> true
|
229
|
+
*
|
230
|
+
- * t = Time.now #=> 2007-11-19 08:18:51 -0600
|
231
|
+
+ * t = Time.now # 2007-11-19 08:18:51 -0600
|
232
|
+
* t.utc? #=> false
|
233
|
+
- * t.utc #=> 2007-11-19 14:18:51 UTC
|
234
|
+
+ * t.utc # 2007-11-19 14:18:51 UTC
|
235
|
+
* t.utc? #=> true
|
236
|
+
*/
|
237
|
+
|
238
|
+
@@ -3604,14 +3605,14 @@
|
239
|
+
*
|
240
|
+
* If +utc_offset+ is given, it is used instead of the local time.
|
241
|
+
*
|
242
|
+
- * t = Time.utc(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
243
|
+
+ * t = Time.utc(2000,1,1,20,15,1) # > 2000-01-01 20:15:01 UTC
|
244
|
+
* t.utc? #=> true
|
245
|
+
*
|
246
|
+
- * l = t.getlocal #=> 2000-01-01 14:15:01 -0600
|
247
|
+
+ * l = t.getlocal # 2000-01-01 14:15:01 -0600
|
248
|
+
* l.utc? #=> false
|
249
|
+
* t == l #=> true
|
250
|
+
*
|
251
|
+
- * j = t.getlocal("+09:00") #=> 2000-01-02 05:15:01 +0900
|
252
|
+
+ * j = t.getlocal("+09:00") # > 2000-01-02 05:15:01 +0900
|
253
|
+
* j.utc? #=> false
|
254
|
+
* t == j #=> true
|
255
|
+
*/
|
256
|
+
@@ -3641,9 +3642,9 @@
|
257
|
+
*
|
258
|
+
* Returns a new Time object representing _time_ in UTC.
|
259
|
+
*
|
260
|
+
- * t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600
|
261
|
+
+ * t = Time.local(2000,1,1,20,15,1) # 2000-01-01 20:15:01 -0600
|
262
|
+
* t.gmt? #=> false
|
263
|
+
- * y = t.getgm #=> 2000-01-02 02:15:01 UTC
|
264
|
+
+ * y = t.getgm # 2000-01-02 02:15:01 UTC
|
265
|
+
* y.gmt? #=> true
|
266
|
+
* t == y #=> true
|
267
|
+
*/
|
268
|
+
@@ -3671,7 +3672,7 @@
|
269
|
+
*
|
270
|
+
* Returns a canonical string representation of _time_.
|
271
|
+
*
|
272
|
+
- * Time.now.asctime #=> "Wed Apr 9 08:56:03 2003"
|
273
|
+
+ * Time.now.asctime #-> "Wed Apr 9 08:56:03 2003"
|
274
|
+
*/
|
275
|
+
|
276
|
+
static VALUE
|
277
|
+
@@ -3689,11 +3690,11 @@
|
278
|
+
* #strftime with the appropriate format string.
|
279
|
+
*
|
280
|
+
* t = Time.now
|
281
|
+
- * t.to_s => "2012-11-10 18:16:12 +0100"
|
282
|
+
- * t.strftime "%Y-%m-%d %H:%M:%S %z" => "2012-11-10 18:16:12 +0100"
|
283
|
+
+ * t.to_s #-> "2012-11-10 18:16:12 +0100"
|
284
|
+
+ * t.strftime "%Y-%m-%d %H:%M:%S %z" #-> "2012-11-10 18:16:12 +0100"
|
285
|
+
*
|
286
|
+
- * t.utc.to_s => "2012-11-10 17:16:12 UTC"
|
287
|
+
- * t.strftime "%Y-%m-%d %H:%M:%S UTC" => "2012-11-10 17:16:12 UTC"
|
288
|
+
+ * t.utc.to_s #-> "2012-11-10 17:16:12 UTC"
|
289
|
+
+ * t.strftime "%Y-%m-%d %H:%M:%S UTC" #-> "2012-11-10 17:16:12 UTC"
|
290
|
+
*/
|
291
|
+
|
292
|
+
static VALUE
|
293
|
+
@@ -3736,8 +3737,9 @@
|
294
|
+
* Addition --- Adds some number of seconds (possibly fractional) to
|
295
|
+
* _time_ and returns that value as a new Time object.
|
296
|
+
*
|
297
|
+
- * t = Time.now #=> 2007-11-19 08:22:21 -0600
|
298
|
+
- * t + (60 * 60 * 24) #=> 2007-11-20 08:22:21 -0600
|
299
|
+
+ * t = Time.now # 2007-11-19 08:22:21 -0600
|
300
|
+
+ * t2 = t + (60 * 60 * 24) # 2007-11-20 08:22:21 -0600
|
301
|
+
+ * t2 - t #=> 60 * 60 * 24
|
302
|
+
*/
|
303
|
+
|
304
|
+
static VALUE
|
305
|
+
@@ -3761,10 +3763,10 @@
|
306
|
+
* between _time_ and +other_time+, or subtracts the given number
|
307
|
+
* of seconds in +numeric+ from _time_.
|
308
|
+
*
|
309
|
+
- * t = Time.now #=> 2007-11-19 08:23:10 -0600
|
310
|
+
- * t2 = t + 2592000 #=> 2007-12-19 08:23:10 -0600
|
311
|
+
+ * t = Time.now # 2007-11-19 08:23:10 -0600
|
312
|
+
+ * t2 = t + 2592000 # 2007-12-19 08:23:10 -0600
|
313
|
+
* t2 - t #=> 2592000.0
|
314
|
+
- * t2 - 2592000 #=> 2007-11-19 08:23:10 -0600
|
315
|
+
+ * t2 - 2592000 == t #=> true
|
316
|
+
*/
|
317
|
+
|
318
|
+
static VALUE
|
319
|
+
@@ -3789,12 +3791,15 @@
|
320
|
+
* Returns a new Time object, one second later than _time_.
|
321
|
+
* Time#succ is obsolete since 1.9.2 for time is not a discrete value.
|
322
|
+
*
|
323
|
+
- * t = Time.now #=> 2007-11-19 08:23:57 -0600
|
324
|
+
- * t.succ #=> 2007-11-19 08:23:58 -0600
|
325
|
+
+ * t = Time.now # 2007-11-19 08:23:57 -0600
|
326
|
+
+ * t.succ # 2007-11-19 08:23:58 -0600
|
327
|
+
+ * produces on stderr:
|
328
|
+
+ * :rdx: stderr
|
329
|
+
+ * warning: Time#succ is obsolete; use time + 1
|
330
|
+
*
|
331
|
+
* Use instead <code>time + 1</code>
|
332
|
+
- *
|
333
|
+
- * t + 1 #=> 2007-11-19 08:23:58 -0600
|
334
|
+
+ * :rdx: no_warnings stderr
|
335
|
+
+ * t + 1 == t.succ #=> true
|
336
|
+
*/
|
337
|
+
|
338
|
+
VALUE
|
339
|
+
@@ -3824,30 +3829,30 @@
|
340
|
+
* require 'time'
|
341
|
+
*
|
342
|
+
* t = Time.utc(2010,3,30, 5,43,"25.123456789".to_r)
|
343
|
+
- * p t.iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
|
344
|
+
- * p t.round.iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
|
345
|
+
- * p t.round(0).iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
|
346
|
+
- * p t.round(1).iso8601(10) #=> "2010-03-30T05:43:25.1000000000Z"
|
347
|
+
- * p t.round(2).iso8601(10) #=> "2010-03-30T05:43:25.1200000000Z"
|
348
|
+
- * p t.round(3).iso8601(10) #=> "2010-03-30T05:43:25.1230000000Z"
|
349
|
+
- * p t.round(4).iso8601(10) #=> "2010-03-30T05:43:25.1235000000Z"
|
350
|
+
- * p t.round(5).iso8601(10) #=> "2010-03-30T05:43:25.1234600000Z"
|
351
|
+
- * p t.round(6).iso8601(10) #=> "2010-03-30T05:43:25.1234570000Z"
|
352
|
+
- * p t.round(7).iso8601(10) #=> "2010-03-30T05:43:25.1234568000Z"
|
353
|
+
- * p t.round(8).iso8601(10) #=> "2010-03-30T05:43:25.1234567900Z"
|
354
|
+
- * p t.round(9).iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
|
355
|
+
- * p t.round(10).iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
|
356
|
+
+ * t.iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
|
357
|
+
+ * t.round.iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
|
358
|
+
+ * t.round(0).iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
|
359
|
+
+ * t.round(1).iso8601(10) #=> "2010-03-30T05:43:25.1000000000Z"
|
360
|
+
+ * t.round(2).iso8601(10) #=> "2010-03-30T05:43:25.1200000000Z"
|
361
|
+
+ * t.round(3).iso8601(10) #=> "2010-03-30T05:43:25.1230000000Z"
|
362
|
+
+ * t.round(4).iso8601(10) #=> "2010-03-30T05:43:25.1235000000Z"
|
363
|
+
+ * t.round(5).iso8601(10) #=> "2010-03-30T05:43:25.1234600000Z"
|
364
|
+
+ * t.round(6).iso8601(10) #=> "2010-03-30T05:43:25.1234570000Z"
|
365
|
+
+ * t.round(7).iso8601(10) #=> "2010-03-30T05:43:25.1234568000Z"
|
366
|
+
+ * t.round(8).iso8601(10) #=> "2010-03-30T05:43:25.1234567900Z"
|
367
|
+
+ * t.round(9).iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
|
368
|
+
+ * t.round(10).iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
|
369
|
+
*
|
370
|
+
* t = Time.utc(1999,12,31, 23,59,59)
|
371
|
+
- * p((t + 0.4).round.iso8601(3)) #=> "1999-12-31T23:59:59.000Z"
|
372
|
+
- * p((t + 0.49).round.iso8601(3)) #=> "1999-12-31T23:59:59.000Z"
|
373
|
+
- * p((t + 0.5).round.iso8601(3)) #=> "2000-01-01T00:00:00.000Z"
|
374
|
+
- * p((t + 1.4).round.iso8601(3)) #=> "2000-01-01T00:00:00.000Z"
|
375
|
+
- * p((t + 1.49).round.iso8601(3)) #=> "2000-01-01T00:00:00.000Z"
|
376
|
+
- * p((t + 1.5).round.iso8601(3)) #=> "2000-01-01T00:00:01.000Z"
|
377
|
+
+ * (t + 0.4).round.iso8601(3) #=> "1999-12-31T23:59:59.000Z"
|
378
|
+
+ * (t + 0.49).round.iso8601(3) #=> "1999-12-31T23:59:59.000Z"
|
379
|
+
+ * (t + 0.5).round.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
|
380
|
+
+ * (t + 1.4).round.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
|
381
|
+
+ * (t + 1.49).round.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
|
382
|
+
+ * (t + 1.5).round.iso8601(3) #=> "2000-01-01T00:00:01.000Z"
|
383
|
+
*
|
384
|
+
* t = Time.utc(1999,12,31, 23,59,59)
|
385
|
+
- * p (t + 0.123456789).round(4).iso8601(6) #=> "1999-12-31T23:59:59.123500Z"
|
386
|
+
+ * (t + 0.123456789).round(4).iso8601(6) #=> "1999-12-31T23:59:59.123500Z"
|
387
|
+
*/
|
388
|
+
|
389
|
+
static VALUE
|
390
|
+
@@ -3897,8 +3902,8 @@
|
391
|
+
* leap seconds. See http://en.wikipedia.org/wiki/Leap_second for further
|
392
|
+
* details.
|
393
|
+
*
|
394
|
+
- * t = Time.now #=> 2007-11-19 08:25:02 -0600
|
395
|
+
- * t.sec #=> 2
|
396
|
+
+ * t = Time.now # 2007-11-19 08:25:02 -0600
|
397
|
+
+ * t.sec #-> 2
|
398
|
+
*/
|
399
|
+
|
400
|
+
static VALUE
|
401
|
+
@@ -3917,8 +3922,8 @@
|
402
|
+
*
|
403
|
+
* Returns the minute of the hour (0..59) for _time_.
|
404
|
+
*
|
405
|
+
- * t = Time.now #=> 2007-11-19 08:25:51 -0600
|
406
|
+
- * t.min #=> 25
|
407
|
+
+ * t = Time.now # 2007-11-19 08:25:51 -0600
|
408
|
+
+ * t.min #-> 25
|
409
|
+
*/
|
410
|
+
|
411
|
+
static VALUE
|
412
|
+
@@ -3937,8 +3942,8 @@
|
413
|
+
*
|
414
|
+
* Returns the hour of the day (0..23) for _time_.
|
415
|
+
*
|
416
|
+
- * t = Time.now #=> 2007-11-19 08:26:20 -0600
|
417
|
+
- * t.hour #=> 8
|
418
|
+
+ * t = Time.now # 2007-11-19 08:26:20 -0600
|
419
|
+
+ * t.hour #-> 8
|
420
|
+
*/
|
421
|
+
|
422
|
+
static VALUE
|
423
|
+
@@ -3958,9 +3963,9 @@
|
424
|
+
*
|
425
|
+
* Returns the day of the month (1..n) for _time_.
|
426
|
+
*
|
427
|
+
- * t = Time.now #=> 2007-11-19 08:27:03 -0600
|
428
|
+
- * t.day #=> 19
|
429
|
+
- * t.mday #=> 19
|
430
|
+
+ * t = Time.now # 2007-11-19 08:27:03 -0600
|
431
|
+
+ * t.day #-> 19
|
432
|
+
+ * t.mday #-> 19
|
433
|
+
*/
|
434
|
+
|
435
|
+
static VALUE
|
436
|
+
@@ -3980,9 +3985,9 @@
|
437
|
+
*
|
438
|
+
* Returns the month of the year (1..12) for _time_.
|
439
|
+
*
|
440
|
+
- * t = Time.now #=> 2007-11-19 08:27:30 -0600
|
441
|
+
- * t.mon #=> 11
|
442
|
+
- * t.month #=> 11
|
443
|
+
+ * t = Time.now # 2007-11-19 08:27:30 -0600
|
444
|
+
+ * t.mon #-> 11
|
445
|
+
+ * t.month #-> 11
|
446
|
+
*/
|
447
|
+
|
448
|
+
static VALUE
|
449
|
+
@@ -4001,8 +4006,8 @@
|
450
|
+
*
|
451
|
+
* Returns the year for _time_ (including the century).
|
452
|
+
*
|
453
|
+
- * t = Time.now #=> 2007-11-19 08:27:51 -0600
|
454
|
+
- * t.year #=> 2007
|
455
|
+
+ * t = Time.now # 2007-11-19 08:27:51 -0600
|
456
|
+
+ * t.year #-> 2007
|
457
|
+
*/
|
458
|
+
|
459
|
+
static VALUE
|
460
|
+
@@ -4022,15 +4027,15 @@
|
461
|
+
* Returns an integer representing the day of the week, 0..6, with
|
462
|
+
* Sunday == 0.
|
463
|
+
*
|
464
|
+
- * t = Time.now #=> 2007-11-20 02:35:35 -0600
|
465
|
+
- * t.wday #=> 2
|
466
|
+
- * t.sunday? #=> false
|
467
|
+
- * t.monday? #=> false
|
468
|
+
- * t.tuesday? #=> true
|
469
|
+
- * t.wednesday? #=> false
|
470
|
+
- * t.thursday? #=> false
|
471
|
+
- * t.friday? #=> false
|
472
|
+
- * t.saturday? #=> false
|
473
|
+
+ * t = Time.now # 2007-11-20 02:35:35 -0600
|
474
|
+
+ * t.wday #-> 2
|
475
|
+
+ * t.sunday? #-> false
|
476
|
+
+ * t.monday? #-> false
|
477
|
+
+ * t.tuesday? #-> true
|
478
|
+
+ * t.wednesday? #-> false
|
479
|
+
+ * t.thursday? #-> false
|
480
|
+
+ * t.friday? #-> false
|
481
|
+
+ * t.saturday? #-> false
|
482
|
+
*/
|
483
|
+
|
484
|
+
static VALUE
|
485
|
+
@@ -4056,8 +4061,8 @@
|
486
|
+
*
|
487
|
+
* Returns +true+ if _time_ represents Sunday.
|
488
|
+
*
|
489
|
+
- * t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600
|
490
|
+
- * t.sunday? #=> true
|
491
|
+
+ * t = Time.utc(1990, 4, 1) # > 1990-04-01 00:00:00 UTC
|
492
|
+
+ * t.sunday? #=> true
|
493
|
+
*/
|
494
|
+
|
495
|
+
static VALUE
|
496
|
+
@@ -4072,8 +4077,8 @@
|
497
|
+
*
|
498
|
+
* Returns +true+ if _time_ represents Monday.
|
499
|
+
*
|
500
|
+
- * t = Time.local(2003, 8, 4) #=> 2003-08-04 00:00:00 -0500
|
501
|
+
- * p t.monday? #=> true
|
502
|
+
+ * t = Time.utc(2003, 8, 4) # > 2003-08-04 00:00:00 UTC
|
503
|
+
+ * t.monday? #=> true
|
504
|
+
*/
|
505
|
+
|
506
|
+
static VALUE
|
507
|
+
@@ -4088,8 +4093,8 @@
|
508
|
+
*
|
509
|
+
* Returns +true+ if _time_ represents Tuesday.
|
510
|
+
*
|
511
|
+
- * t = Time.local(1991, 2, 19) #=> 1991-02-19 00:00:00 -0600
|
512
|
+
- * p t.tuesday? #=> true
|
513
|
+
+ * t = Time.utc(1991, 2, 19) # > 1991-02-19 00:00:00 UTC
|
514
|
+
+ * t.tuesday? #=> true
|
515
|
+
*/
|
516
|
+
|
517
|
+
static VALUE
|
518
|
+
@@ -4104,8 +4109,8 @@
|
519
|
+
*
|
520
|
+
* Returns +true+ if _time_ represents Wednesday.
|
521
|
+
*
|
522
|
+
- * t = Time.local(1993, 2, 24) #=> 1993-02-24 00:00:00 -0600
|
523
|
+
- * p t.wednesday? #=> true
|
524
|
+
+ * t = Time.utc(1993, 2, 24) # > 1993-02-24 00:00:00 UTC
|
525
|
+
+ * t.wednesday? #=> true
|
526
|
+
*/
|
527
|
+
|
528
|
+
static VALUE
|
529
|
+
@@ -4120,8 +4125,8 @@
|
530
|
+
*
|
531
|
+
* Returns +true+ if _time_ represents Thursday.
|
532
|
+
*
|
533
|
+
- * t = Time.local(1995, 12, 21) #=> 1995-12-21 00:00:00 -0600
|
534
|
+
- * p t.thursday? #=> true
|
535
|
+
+ * t = Time.utc(1995, 12, 21) # > 1995-12-21 00:00:00 UTC
|
536
|
+
+ * t.thursday? #=> true
|
537
|
+
*/
|
538
|
+
|
539
|
+
static VALUE
|
540
|
+
@@ -4136,8 +4141,8 @@
|
541
|
+
*
|
542
|
+
* Returns +true+ if _time_ represents Friday.
|
543
|
+
*
|
544
|
+
- * t = Time.local(1987, 12, 18) #=> 1987-12-18 00:00:00 -0600
|
545
|
+
- * t.friday? #=> true
|
546
|
+
+ * t = Time.utc(1987, 12, 18) # > 1987-12-18 00:00:00 UTC
|
547
|
+
+ * t.friday? #=> true
|
548
|
+
*/
|
549
|
+
|
550
|
+
static VALUE
|
551
|
+
@@ -4152,8 +4157,8 @@
|
552
|
+
*
|
553
|
+
* Returns +true+ if _time_ represents Saturday.
|
554
|
+
*
|
555
|
+
- * t = Time.local(2006, 6, 10) #=> 2006-06-10 00:00:00 -0500
|
556
|
+
- * t.saturday? #=> true
|
557
|
+
+ * t = Time.utc(2006, 6, 10) # > 2006-06-10 00:00:00 UTC
|
558
|
+
+ * t.saturday? #=> true
|
559
|
+
*/
|
560
|
+
|
561
|
+
static VALUE
|
562
|
+
@@ -4168,8 +4173,8 @@
|
563
|
+
*
|
564
|
+
* Returns an integer representing the day of the year, 1..366.
|
565
|
+
*
|
566
|
+
- * t = Time.now #=> 2007-11-19 08:32:31 -0600
|
567
|
+
- * t.yday #=> 323
|
568
|
+
+ * t = Time.now # 2007-11-19 08:32:31 -0600
|
569
|
+
+ * t.yday #-> 323
|
570
|
+
*/
|
571
|
+
|
572
|
+
static VALUE
|
573
|
+
@@ -4190,6 +4195,7 @@
|
574
|
+
* Returns +true+ if _time_ occurs during Daylight
|
575
|
+
* Saving Time in its time zone.
|
576
|
+
*
|
577
|
+
+ * :rdx: if Time.now.zone == "CST"
|
578
|
+
* # CST6CDT:
|
579
|
+
* Time.local(2000, 1, 1).zone #=> "CST"
|
580
|
+
* Time.local(2000, 1, 1).isdst #=> false
|
581
|
+
@@ -4198,6 +4204,7 @@
|
582
|
+
* Time.local(2000, 7, 1).isdst #=> true
|
583
|
+
* Time.local(2000, 7, 1).dst? #=> true
|
584
|
+
*
|
585
|
+
+ * :rdx: if Time.now.zone == "JST"
|
586
|
+
* # Asia/Tokyo:
|
587
|
+
* Time.local(2000, 1, 1).zone #=> "JST"
|
588
|
+
* Time.local(2000, 1, 1).isdst #=> false
|
589
|
+
@@ -4227,7 +4234,7 @@
|
590
|
+
* t = Time.gm(2000, "jan", 1, 20, 15, 1)
|
591
|
+
* t.zone #=> "UTC"
|
592
|
+
* t = Time.local(2000, "jan", 1, 20, 15, 1)
|
593
|
+
- * t.zone #=> "CST"
|
594
|
+
+ * t.zone #-> "CST"
|
595
|
+
*/
|
596
|
+
|
597
|
+
static VALUE
|
598
|
+
@@ -4255,10 +4262,10 @@
|
599
|
+
* Returns the offset in seconds between the timezone of _time_
|
600
|
+
* and UTC.
|
601
|
+
*
|
602
|
+
- * t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
603
|
+
+ * t = Time.gm(2000,1,1,20,15,1) # > 2000-01-01 20:15:01 UTC
|
604
|
+
* t.gmt_offset #=> 0
|
605
|
+
- * l = t.getlocal #=> 2000-01-01 14:15:01 -0600
|
606
|
+
- * l.gmt_offset #=> -21600
|
607
|
+
+ * l = t.getlocal # 2000-01-01 14:15:01 -0600
|
608
|
+
+ * l.gmt_offset #-> -21600
|
609
|
+
*/
|
610
|
+
|
611
|
+
static VALUE
|
612
|
+
@@ -4282,16 +4289,18 @@
|
613
|
+
* time.to_a -> array
|
614
|
+
*
|
615
|
+
* Returns a ten-element _array_ of values for _time_:
|
616
|
+
- *
|
617
|
+
+ *
|
618
|
+
+ * :rdx: off -
|
619
|
+
* [sec, min, hour, day, month, year, wday, yday, isdst, zone]
|
620
|
+
*
|
621
|
+
* See the individual methods for an explanation of the
|
622
|
+
* valid ranges of each value. The ten elements can be passed directly
|
623
|
+
* to Time::utc or Time::local to create a
|
624
|
+
* new Time object.
|
625
|
+
- *
|
626
|
+
- * t = Time.now #=> 2007-11-19 08:36:01 -0600
|
627
|
+
- * now = t.to_a #=> [1, 36, 8, 19, 11, 2007, 1, 323, false, "CST"]
|
628
|
+
+ *
|
629
|
+
+ * :rdx: on
|
630
|
+
+ * t = Time.now # 2007-11-19 08:36:01 -0600
|
631
|
+
+ * now = t.to_a #-> [1, 36, 8, 19, 11, 2007, 1, 323, false, "CST"]
|
632
|
+
*/
|
633
|
+
|
634
|
+
static VALUE
|
635
|
+
@@ -4392,6 +4401,7 @@
|
636
|
+
* zero or more flags, optional minimum field width,
|
637
|
+
* optional modifier and a conversion specifier
|
638
|
+
* as follows:
|
639
|
+
+ * :rdx: off
|
640
|
+
*
|
641
|
+
* %<flags><width><modifier><conversion>
|
642
|
+
*
|
643
|
+
@@ -4519,12 +4529,14 @@
|
644
|
+
* So the numeric time zone offset, %z, is recommended.
|
645
|
+
*
|
646
|
+
* Examples:
|
647
|
+
+ * :rdx: on
|
648
|
+
*
|
649
|
+
- * t = Time.new(2007,11,19,8,37,48,"-06:00") #=> 2007-11-19 08:37:48 -0600
|
650
|
+
+ * t = Time.new(2007,11,19,8,37,48,"-06:00") # > 2007-11-19 08:37:48 -0600
|
651
|
+
* t.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007"
|
652
|
+
* t.strftime("at %I:%M%p") #=> "at 08:37AM"
|
653
|
+
*
|
654
|
+
* Various ISO 8601 formats:
|
655
|
+
+ * :rdx: off -
|
656
|
+
* %Y%m%d => 20071119 Calendar date (basic)
|
657
|
+
* %F => 2007-11-19 Calendar date (extended)
|
658
|
+
* %Y-%m => 2007-11 Calendar date, reduced accuracy, specific month
|
659
|
+
@@ -4889,10 +4901,10 @@
|
660
|
+
* pass the year with nothing else time will default to January 1 of that year
|
661
|
+
* at 00:00:00 with the current system timezone. Here are some examples:
|
662
|
+
*
|
663
|
+
- * Time.new(2002) #=> 2002-01-01 00:00:00 -0500
|
664
|
+
- * Time.new(2002, 10) #=> 2002-10-01 00:00:00 -0500
|
665
|
+
- * Time.new(2002, 10, 31) #=> 2002-10-31 00:00:00 -0500
|
666
|
+
- * Time.new(2002, 10, 31, 2, 2, 2, "+02:00") #=> 2002-10-31 02:02:02 -0200
|
667
|
+
+ * Time.new(2002) # 2002-01-01 00:00:00 -0500
|
668
|
+
+ * Time.new(2002, 10) # 2002-10-01 00:00:00 -0500
|
669
|
+
+ * Time.new(2002, 10, 31) # 2002-10-31 00:00:00 -0500
|
670
|
+
+ * Time.new(2002, 10, 31, 2, 2, 2, "+02:00") # > 2002-10-31 02:02:02 +0200
|
671
|
+
*
|
672
|
+
* You can also use #gm, #local and
|
673
|
+
* #utc to infer GMT, local and UTC timezones instead of using
|
674
|
+
@@ -4902,7 +4914,7 @@
|
675
|
+
* seconds (or fraction of seconds) since the {Unix
|
676
|
+
* Epoch}[http://en.wikipedia.org/wiki/Unix_time].
|
677
|
+
*
|
678
|
+
- * Time.at(628232400) #=> 1989-11-28 00:00:00 -0500
|
679
|
+
+ * Time.at(628232400) # 1989-11-28 00:00:00 -0500
|
680
|
+
*
|
681
|
+
* == Working with an instance of Time
|
682
|
+
*
|
683
|
+
@@ -4926,7 +4938,7 @@
|
684
|
+
*
|
685
|
+
* What's the day a year later?
|
686
|
+
*
|
687
|
+
- * t + (60*60*24*365) #=> 1994-02-24 12:00:00 +0900
|
688
|
+
+ * t + (60*60*24*365) # > 1994-02-24 12:00:00 +0900
|
689
|
+
*
|
690
|
+
* How many seconds was that since the Unix Epoch?
|
691
|
+
*
|