mrubyを超漢字で動作させる
Revisão | 5cdcce8dbddd94ecb9503a0a1d47370c4ef97177 (tree) |
---|---|
Hora | 2015-10-21 00:16:47 |
Autor | Seba Gamboa <me@sagm...> |
Commiter | Seba Gamboa |
Mark core gems with mrbgem tag
@@ -32,12 +32,34 @@ MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_va | ||
32 | 32 | /* declaration for fail method */ |
33 | 33 | MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value); |
34 | 34 | |
35 | -/* functions defined in mruby-error mrbgem */ | |
35 | +/** | |
36 | + * Protect | |
37 | + * | |
38 | + * @mrbgem mruby-error | |
39 | + */ | |
36 | 40 | MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state); |
41 | + | |
42 | +/** | |
43 | + * Ensure | |
44 | + * | |
45 | + * @mrbgem mruby-error | |
46 | + */ | |
37 | 47 | MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data, |
38 | 48 | mrb_func_t ensure, mrb_value e_data); |
49 | + | |
50 | +/** | |
51 | + * Rescue | |
52 | + * | |
53 | + * @mrbgem mruby-error | |
54 | + */ | |
39 | 55 | MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data, |
40 | 56 | mrb_func_t rescue, mrb_value r_data); |
57 | + | |
58 | +/** | |
59 | + * Rescue exception | |
60 | + * | |
61 | + * @mrbgem mruby-error | |
62 | + */ | |
41 | 63 | MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data, |
42 | 64 | mrb_func_t rescue, mrb_value r_data, |
43 | 65 | mrb_int len, struct RClass **classes); |
@@ -1,4 +1,5 @@ | ||
1 | 1 | class Array |
2 | + | |
2 | 3 | ## |
3 | 4 | # call-seq: |
4 | 5 | # ary.uniq! -> ary or nil |
@@ -15,6 +16,7 @@ class Array | ||
15 | 16 | # c = [["student","sam"], ["student","george"], ["teacher","matz"]] |
16 | 17 | # c.uniq! { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] |
17 | 18 | # |
19 | + # @mrbgem mruby-array-ext | |
18 | 20 | def uniq!(&block) |
19 | 21 | ary = self.dup |
20 | 22 | result = [] |
@@ -54,6 +56,7 @@ class Array | ||
54 | 56 | # b = [["student","sam"], ["student","george"], ["teacher","matz"]] |
55 | 57 | # b.uniq { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] |
56 | 58 | # |
59 | + # @mrbgem mruby-array-ext | |
57 | 60 | def uniq(&block) |
58 | 61 | ary = self.dup |
59 | 62 | if block |
@@ -75,6 +78,7 @@ class Array | ||
75 | 78 | # |
76 | 79 | # [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ] |
77 | 80 | # |
81 | + # @mrbgem mruby-array-ext | |
78 | 82 | def -(elem) |
79 | 83 | raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array |
80 | 84 |
@@ -95,6 +99,7 @@ class Array | ||
95 | 99 | # [ "a", "b", "c" ] | [ "c", "d", "a" ] |
96 | 100 | # #=> [ "a", "b", "c", "d" ] |
97 | 101 | # |
102 | + # @mrbgem mruby-array-ext | |
98 | 103 | def |(elem) |
99 | 104 | raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array |
100 | 105 |
@@ -111,6 +116,7 @@ class Array | ||
111 | 116 | # |
112 | 117 | # [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ] |
113 | 118 | # |
119 | + # @mrbgem mruby-array-ext | |
114 | 120 | def &(elem) |
115 | 121 | raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array |
116 | 122 |
@@ -143,6 +149,7 @@ class Array | ||
143 | 149 | # a = [ 1, 2, [3, [4, 5] ] ] |
144 | 150 | # a.flatten(1) #=> [1, 2, 3, [4, 5]] |
145 | 151 | # |
152 | + # @mrbgem mruby-array-ext | |
146 | 153 | def flatten(depth=nil) |
147 | 154 | ar = [] |
148 | 155 | self.each do |e| |
@@ -172,6 +179,7 @@ class Array | ||
172 | 179 | # a = [ 1, 2, [3, [4, 5] ] ] |
173 | 180 | # a.flatten!(1) #=> [1, 2, 3, [4, 5]] |
174 | 181 | # |
182 | + # @mrbgem mruby-array-ext | |
175 | 183 | def flatten!(depth=nil) |
176 | 184 | modified = false |
177 | 185 | ar = [] |
@@ -199,6 +207,7 @@ class Array | ||
199 | 207 | # [ "a", nil, "b", nil, "c", nil ].compact |
200 | 208 | # #=> [ "a", "b", "c" ] |
201 | 209 | # |
210 | + # @mrbgem mruby-array-ext | |
202 | 211 | def compact |
203 | 212 | result = self.dup |
204 | 213 | result.compact! |
@@ -216,6 +225,7 @@ class Array | ||
216 | 225 | # [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ] |
217 | 226 | # [ "a", "b", "c" ].compact! #=> nil |
218 | 227 | # |
228 | + # @mrbgem mruby-array-ext | |
219 | 229 | def compact! |
220 | 230 | result = self.select { |e| !e.nil? } |
221 | 231 | if result.size == self.size |
@@ -226,6 +236,7 @@ class Array | ||
226 | 236 | end |
227 | 237 | |
228 | 238 | # for efficiency |
239 | + # @mrbgem mruby-array-ext | |
229 | 240 | def reverse_each(&block) |
230 | 241 | return to_enum :reverse_each unless block_given? |
231 | 242 |
@@ -238,6 +249,7 @@ class Array | ||
238 | 249 | end |
239 | 250 | |
240 | 251 | NONE=Object.new |
252 | + | |
241 | 253 | ## |
242 | 254 | # call-seq: |
243 | 255 | # ary.fetch(index) -> obj |
@@ -260,7 +272,7 @@ class Array | ||
260 | 272 | # a.fetch(100) { |i| puts "#{i} is out of bounds" } |
261 | 273 | # #=> "100 is out of bounds" |
262 | 274 | # |
263 | - | |
275 | + # @mrbgem mruby-array-ext | |
264 | 276 | def fetch(n=nil, ifnone=NONE, &block) |
265 | 277 | warn "block supersedes default value argument" if !n.nil? && ifnone != NONE && block |
266 | 278 |
@@ -310,7 +322,7 @@ class Array | ||
310 | 322 | # a.fill(1, 2) { |i| i+1 } #=> [0, 2, 3, 27] |
311 | 323 | # a.fill(0..1) { |i| i+1 } #=> [1, 2, 3, 27] |
312 | 324 | # |
313 | - | |
325 | + # @mrbgem mruby-array-ext | |
314 | 326 | def fill(arg0=nil, arg1=nil, arg2=nil, &block) |
315 | 327 | if arg0.nil? && arg1.nil? && arg2.nil? && !block |
316 | 328 | raise ArgumentError, "wrong number of arguments (0 for 1..3)" |
@@ -394,7 +406,8 @@ class Array | ||
394 | 406 | # a #=> ["a", "b", "c", "d"] |
395 | 407 | # a.rotate(2) #=> ["c", "d", "a", "b"] |
396 | 408 | # a.rotate(-3) #=> ["b", "c", "d", "a"] |
397 | - | |
409 | + # | |
410 | + # @mrbgem mruby-array-ext | |
398 | 411 | def rotate(count=1) |
399 | 412 | ary = [] |
400 | 413 | len = self.length |
@@ -425,12 +438,12 @@ class Array | ||
425 | 438 | # a #=> ["b", "c", "d", "a"] |
426 | 439 | # a.rotate!(2) #=> ["d", "a", "b", "c"] |
427 | 440 | # a.rotate!(-3) #=> ["a", "b", "c", "d"] |
428 | - | |
441 | + # | |
442 | + # @mrbgem mruby-array-ext | |
429 | 443 | def rotate!(count=1) |
430 | 444 | self.replace(self.rotate(count)) |
431 | 445 | end |
432 | 446 | |
433 | - ## | |
434 | 447 | # call-seq: |
435 | 448 | # ary.delete_if { |item| block } -> ary |
436 | 449 | # ary.delete_if -> Enumerator |
@@ -446,7 +459,8 @@ class Array | ||
446 | 459 | # |
447 | 460 | # scores = [ 97, 42, 75 ] |
448 | 461 | # scores.delete_if {|score| score < 80 } #=> [97] |
449 | - | |
462 | + # | |
463 | + # @mrbgem mruby-array-ext | |
450 | 464 | def delete_if(&block) |
451 | 465 | return to_enum :delete_if unless block_given? |
452 | 466 |
@@ -475,7 +489,8 @@ class Array | ||
475 | 489 | # See also Enumerable#reject and Array#delete_if. |
476 | 490 | # |
477 | 491 | # If no block is given, an Enumerator is returned instead. |
478 | - | |
492 | + # | |
493 | + # @mrbgem mruby-array-ext | |
479 | 494 | def reject!(&block) |
480 | 495 | return to_enum :reject! unless block_given? |
481 | 496 |
@@ -507,7 +522,8 @@ class Array | ||
507 | 522 | # a = %w{ a b c d } |
508 | 523 | # a.insert(2, 99) #=> ["a", "b", 99, "c", "d"] |
509 | 524 | # a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"] |
510 | - | |
525 | + # | |
526 | + # @mrbgem mruby-array-ext | |
511 | 527 | def insert(idx, *args) |
512 | 528 | idx += self.size + 1 if idx < 0 |
513 | 529 | self[idx, 0] = args |
@@ -565,7 +581,8 @@ class Array | ||
565 | 581 | # You must not mix the two modes at a time; the block must always |
566 | 582 | # return either true/false, or always return a number. It is |
567 | 583 | # undefined which value is actually picked up at each iteration. |
568 | - | |
584 | + # | |
585 | + # @mrbgem mruby-array-ext | |
569 | 586 | def bsearch(&block) |
570 | 587 | return to_enum :bsearch unless block_given? |
571 | 588 |
@@ -612,7 +629,8 @@ class Array | ||
612 | 629 | # |
613 | 630 | # scores = [ 97, 42, 75 ] |
614 | 631 | # scores.delete_if {|score| score < 80 } #=> [97] |
615 | - | |
632 | + # | |
633 | + # @mrbgem mruby-array-ext | |
616 | 634 | def delete_if(&block) |
617 | 635 | return to_enum :delete_if unless block_given? |
618 | 636 |
@@ -641,7 +659,8 @@ class Array | ||
641 | 659 | # |
642 | 660 | # a = [1, 2, 3, 4, 5] |
643 | 661 | # a.keep_if { |val| val > 3 } #=> [4, 5] |
644 | - | |
662 | + # | |
663 | + # @mrbgem mruby-array-ext | |
645 | 664 | def keep_if(&block) |
646 | 665 | return to_enum :keep_if unless block_given? |
647 | 666 |
@@ -670,7 +689,8 @@ class Array | ||
670 | 689 | # See also Array#keep_if |
671 | 690 | # |
672 | 691 | # If no block is given, an Enumerator is returned instead. |
673 | - | |
692 | + # | |
693 | + # @mrbgem mruby-array-ext | |
674 | 694 | def select!(&block) |
675 | 695 | return to_enum :select! unless block_given? |
676 | 696 |
@@ -694,6 +714,8 @@ class Array | ||
694 | 714 | # first object for which the block returns +true+. Returns +nil+ if no |
695 | 715 | # match is found. |
696 | 716 | # |
717 | + # @mrbgem mruby-array-ext | |
718 | + # | |
697 | 719 | # ISO 15.2.12.5.14 |
698 | 720 | def index(val=NONE, &block) |
699 | 721 | return to_enum(:find_index, val) if !block && val == NONE |
@@ -4,7 +4,7 @@ | ||
4 | 4 | #include "mruby/range.h" |
5 | 5 | #include "mruby/hash.h" |
6 | 6 | |
7 | -/* | |
7 | +/** | |
8 | 8 | * call-seq: |
9 | 9 | * ary.assoc(obj) -> new_ary or nil |
10 | 10 | * |
@@ -22,8 +22,9 @@ | ||
22 | 22 | * a = [ s1, s2, s3 ] |
23 | 23 | * a.assoc("letters") #=> [ "letters", "a", "b", "c" ] |
24 | 24 | * a.assoc("foo") #=> nil |
25 | + * | |
26 | + * @mrbgem mruby-array-ext | |
25 | 27 | */ |
26 | - | |
27 | 28 | static mrb_value |
28 | 29 | mrb_ary_assoc(mrb_state *mrb, mrb_value ary) |
29 | 30 | { |
@@ -73,7 +74,7 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary) | ||
73 | 74 | return mrb_nil_value(); |
74 | 75 | } |
75 | 76 | |
76 | -/* | |
77 | +/** | |
77 | 78 | * call-seq: |
78 | 79 | * ary.at(index) -> obj or nil |
79 | 80 | * |
@@ -84,8 +85,9 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary) | ||
84 | 85 | * a = [ "a", "b", "c", "d", "e" ] |
85 | 86 | * a.at(0) #=> "a" |
86 | 87 | * a.at(-1) #=> "e" |
88 | + * | |
89 | + * @mrbgem mruby-array-ext | |
87 | 90 | */ |
88 | - | |
89 | 91 | static mrb_value |
90 | 92 | mrb_ary_at(mrb_state *mrb, mrb_value ary) |
91 | 93 | { |
@@ -95,6 +97,10 @@ mrb_ary_at(mrb_state *mrb, mrb_value ary) | ||
95 | 97 | return mrb_ary_entry(ary, pos); |
96 | 98 | } |
97 | 99 | |
100 | +/** | |
101 | + * | |
102 | + * @mrbgem mruby-array-ext | |
103 | + */ | |
98 | 104 | static mrb_value |
99 | 105 | mrb_ary_values_at(mrb_state *mrb, mrb_value self) |
100 | 106 | { |
@@ -106,7 +112,7 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) | ||
106 | 112 | return mrb_get_values_at(mrb, self, RARRAY_LEN(self), argc, argv, mrb_ary_ref); |
107 | 113 | } |
108 | 114 | |
109 | -/* | |
115 | +/** | |
110 | 116 | * call-seq: |
111 | 117 | * ary.to_h -> Hash |
112 | 118 | * |
@@ -115,8 +121,9 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) | ||
115 | 121 | * |
116 | 122 | * [[:foo, :bar], [1, 2]].to_h |
117 | 123 | * # => {:foo => :bar, 1 => 2} |
124 | + * | |
125 | + * @mrbgem mruby-array-ext | |
118 | 126 | */ |
119 | - | |
120 | 127 | static mrb_value |
121 | 128 | mrb_ary_to_h(mrb_state *mrb, mrb_value ary) |
122 | 129 | { |
@@ -1,7 +1,5 @@ | ||
1 | -## | |
2 | -# Enumerable | |
3 | -# | |
4 | 1 | module Enumerable |
2 | + | |
5 | 3 | ## |
6 | 4 | # call-seq: |
7 | 5 | # enum.drop(n) -> array |
@@ -11,7 +9,8 @@ module Enumerable | ||
11 | 9 | # |
12 | 10 | # a = [1, 2, 3, 4, 5, 0] |
13 | 11 | # a.drop(3) #=> [4, 5, 0] |
14 | - | |
12 | + # | |
13 | + # @mrbgem mruby-enum-ext | |
15 | 14 | def drop(n) |
16 | 15 | raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) |
17 | 16 | raise ArgumentError, "attempt to drop negative size" if n < 0 |
@@ -35,7 +34,8 @@ module Enumerable | ||
35 | 34 | # |
36 | 35 | # a = [1, 2, 3, 4, 5, 0] |
37 | 36 | # a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0] |
38 | - | |
37 | + # | |
38 | + # @mrbgem mruby-enum-ext | |
39 | 39 | def drop_while(&block) |
40 | 40 | return to_enum :drop_while unless block |
41 | 41 |
@@ -55,7 +55,8 @@ module Enumerable | ||
55 | 55 | # |
56 | 56 | # a = [1, 2, 3, 4, 5, 0] |
57 | 57 | # a.take(3) #=> [1, 2, 3] |
58 | - | |
58 | + # | |
59 | + # @mrbgem mruby-enum-ext | |
59 | 60 | def take(n) |
60 | 61 | raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) |
61 | 62 | raise ArgumentError, "attempt to take negative size" if n < 0 |
@@ -81,7 +82,8 @@ module Enumerable | ||
81 | 82 | # |
82 | 83 | # a = [1, 2, 3, 4, 5, 0] |
83 | 84 | # a.take_while {|i| i < 3 } #=> [1, 2] |
84 | - | |
85 | + # | |
86 | + # @mrbgem mruby-enum-ext | |
85 | 87 | def take_while(&block) |
86 | 88 | return to_enum :take_while unless block |
87 | 89 |
@@ -111,7 +113,8 @@ module Enumerable | ||
111 | 113 | # [6, 7, 8] |
112 | 114 | # [7, 8, 9] |
113 | 115 | # [8, 9, 10] |
114 | - | |
116 | + # | |
117 | + # @mrbgem mruby-enum-ext | |
115 | 118 | def each_cons(n, &block) |
116 | 119 | raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) |
117 | 120 | raise ArgumentError, "invalid size" if n <= 0 |
@@ -139,7 +142,8 @@ module Enumerable | ||
139 | 142 | # [4, 5, 6] |
140 | 143 | # [7, 8, 9] |
141 | 144 | # [10] |
142 | - | |
145 | + # | |
146 | + # @mrbgem mruby-enum-ext | |
143 | 147 | def each_slice(n, &block) |
144 | 148 | raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) |
145 | 149 | raise ArgumentError, "invalid slice size" if n <= 0 |
@@ -167,7 +171,8 @@ module Enumerable | ||
167 | 171 | # corresponding to the key. |
168 | 172 | # |
169 | 173 | # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} |
170 | - | |
174 | + # | |
175 | + # @mrbgem mruby-enum-ext | |
171 | 176 | def group_by(&block) |
172 | 177 | return to_enum :group_by unless block |
173 | 178 |
@@ -189,7 +194,8 @@ module Enumerable | ||
189 | 194 | # values in <i>enum</i> through the given block. |
190 | 195 | # |
191 | 196 | # If no block is given, an enumerator is returned instead. |
192 | - | |
197 | + # | |
198 | + # @mrbgem mruby-enum-ext | |
193 | 199 | def sort_by(&block) |
194 | 200 | return to_enum :sort_by unless block |
195 | 201 |
@@ -216,6 +222,8 @@ module Enumerable | ||
216 | 222 | # Returns the first element, or the first +n+ elements, of the enumerable. |
217 | 223 | # If the enumerable is empty, the first form returns <code>nil</code>, and the |
218 | 224 | # second form returns an empty array. |
225 | + # | |
226 | + # @mrbgem mruby-enum-ext | |
219 | 227 | def first(n=NONE) |
220 | 228 | if n == NONE |
221 | 229 | self.each do |*val| |
@@ -244,6 +252,8 @@ module Enumerable | ||
244 | 252 | # If an argument is given, the number of items in +enum+ that |
245 | 253 | # are equal to +item+ are counted. If a block is given, it |
246 | 254 | # counts the number of elements yielding a true value. |
255 | + # | |
256 | + # @mrbgem mruby-enum-ext | |
247 | 257 | def count(v=NONE, &block) |
248 | 258 | count = 0 |
249 | 259 | if block |
@@ -276,6 +286,8 @@ module Enumerable | ||
276 | 286 | # |
277 | 287 | # [1, 2, 3, 4].flat_map { |e| [e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4] |
278 | 288 | # [[1, 2], [3, 4]].flat_map { |e| e + [100] } #=> [1, 2, 100, 3, 4, 100] |
289 | + # | |
290 | + # @mrbgem mruby-enum-ext | |
279 | 291 | def flat_map(&block) |
280 | 292 | return to_enum :flat_map unless block |
281 | 293 |
@@ -303,7 +315,8 @@ module Enumerable | ||
303 | 315 | # If no block is given, an enumerator is returned instead. |
304 | 316 | # |
305 | 317 | # %w[albatross dog horse].max_by {|x| x.length } #=> "albatross" |
306 | - | |
318 | + # | |
319 | + # @mrbgem mruby-enum-ext | |
307 | 320 | def max_by(&block) |
308 | 321 | return to_enum :max_by unless block |
309 | 322 |
@@ -337,7 +350,8 @@ module Enumerable | ||
337 | 350 | # If no block is given, an enumerator is returned instead. |
338 | 351 | # |
339 | 352 | # %w[albatross dog horse].min_by {|x| x.length } #=> "dog" |
340 | - | |
353 | + # | |
354 | + # @mrbgem mruby-enum-ext | |
341 | 355 | def min_by(&block) |
342 | 356 | return to_enum :min_by unless block |
343 | 357 |
@@ -373,7 +387,8 @@ module Enumerable | ||
373 | 387 | # a = %w(albatross dog horse) |
374 | 388 | # a.minmax #=> ["albatross", "horse"] |
375 | 389 | # a.minmax { |a, b| a.length <=> b.length } #=> ["dog", "albatross"] |
376 | - | |
390 | + # | |
391 | + # @mrbgem mruby-enum-ext | |
377 | 392 | def minmax(&block) |
378 | 393 | max = nil |
379 | 394 | min = nil |
@@ -411,7 +426,8 @@ module Enumerable | ||
411 | 426 | # If no block is given, an enumerator is returned instead. |
412 | 427 | # |
413 | 428 | # %w(albatross dog horse).minmax_by { |x| x.length } #=> ["dog", "albatross"] |
414 | - | |
429 | + # | |
430 | + # @mrbgem mruby-enum-ext | |
415 | 431 | def minmax_by(&block) |
416 | 432 | return to_enum :minmax_by unless block |
417 | 433 |
@@ -454,7 +470,8 @@ module Enumerable | ||
454 | 470 | # [].none? #=> true |
455 | 471 | # [nil, false].none? #=> true |
456 | 472 | # [nil, true].none? #=> false |
457 | - | |
473 | + # | |
474 | + # @mrbgem mruby-enum-ext | |
458 | 475 | def none?(&block) |
459 | 476 | if block |
460 | 477 | self.each do |*val| |
@@ -484,7 +501,7 @@ module Enumerable | ||
484 | 501 | # [nil, true, 99].one? #=> false |
485 | 502 | # [nil, true, false].one? #=> true |
486 | 503 | # |
487 | - | |
504 | + # @mrbgem mruby-enum-ext | |
488 | 505 | def one?(&block) |
489 | 506 | count = 0 |
490 | 507 | if block |
@@ -515,7 +532,7 @@ module Enumerable | ||
515 | 532 | # (1..10).each_with_object([]) { |i, a| a << i*2 } |
516 | 533 | # #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] |
517 | 534 | # |
518 | - | |
535 | + # @mrbgem mruby-enum-ext | |
519 | 536 | def each_with_object(obj=nil, &block) |
520 | 537 | raise ArgumentError, "wrong number of arguments (0 for 1)" if obj.nil? |
521 | 538 |
@@ -542,7 +559,7 @@ module Enumerable | ||
542 | 559 | # 2 |
543 | 560 | # 1 |
544 | 561 | # |
545 | - | |
562 | + # @mrbgem mruby-enum-ext | |
546 | 563 | def reverse_each(&block) |
547 | 564 | return to_enum :reverse_each unless block |
548 | 565 |
@@ -574,7 +591,7 @@ module Enumerable | ||
574 | 591 | # a.cycle { |x| puts x } # print, a, b, c, a, b, c,.. forever. |
575 | 592 | # a.cycle(2) { |x| puts x } # print, a, b, c, a, b, c. |
576 | 593 | # |
577 | - | |
594 | + # @mrbgem mruby-enum-ext | |
578 | 595 | def cycle(n=nil, &block) |
579 | 596 | return to_enum(:cycle, n) if !block && n.nil? |
580 | 597 |
@@ -623,7 +640,7 @@ module Enumerable | ||
623 | 640 | # (1..100).find_index { |i| i % 5 == 0 and i % 7 == 0 } #=> 34 |
624 | 641 | # (1..100).find_index(50) #=> 49 |
625 | 642 | # |
626 | - | |
643 | + # @mrbgem mruby-enum-ext | |
627 | 644 | def find_index(val=NONE, &block) |
628 | 645 | return to_enum(:find_index, val) if !block && val == NONE |
629 | 646 |
@@ -653,7 +670,7 @@ module Enumerable | ||
653 | 670 | # <code>enum#size</code>. If the size of any argument is less than |
654 | 671 | # <code>enum#size</code>, <code>nil</code> values are supplied. |
655 | 672 | # |
656 | - | |
673 | + # @mrbgem mruby-enum-ext | |
657 | 674 | def zip(*arg) |
658 | 675 | ary = [] |
659 | 676 | arg = arg.map{|a|a.to_a} |
@@ -682,7 +699,7 @@ module Enumerable | ||
682 | 699 | # %i[hello world].each_with_index.to_h |
683 | 700 | # # => {:hello => 0, :world => 1} |
684 | 701 | # |
685 | - | |
702 | + # @mrbgem mruby-enum-ext | |
686 | 703 | def to_h |
687 | 704 | h = {} |
688 | 705 | self.each do |*v| |
@@ -1,30 +1,33 @@ | ||
1 | -# = Enumerable#lazy implementation | |
2 | -# | |
3 | -# Enumerable#lazy returns an instance of Enumerable::Lazy. | |
4 | -# You can use it just like as normal Enumerable object, | |
5 | -# except these methods act as 'lazy': | |
6 | -# | |
7 | -# - map collect | |
8 | -# - select find_all | |
9 | -# - reject | |
10 | -# - grep | |
11 | -# - drop | |
12 | -# - drop_while | |
13 | -# - take_while | |
14 | -# - flat_map collect_concat | |
15 | -# - zip | |
16 | -# | |
17 | -# == Acknowledgements | |
18 | -# | |
19 | -# Based on https://github.com/yhara/enumerable-lazy | |
20 | -# Inspired by https://github.com/antimon2/enumerable_lz | |
21 | -# http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) | |
22 | - | |
23 | 1 | module Enumerable |
2 | + | |
3 | + # = Enumerable#lazy implementation | |
4 | + # | |
5 | + # Enumerable#lazy returns an instance of Enumerable::Lazy. | |
6 | + # You can use it just like as normal Enumerable object, | |
7 | + # except these methods act as 'lazy': | |
8 | + # | |
9 | + # - map collect | |
10 | + # - select find_all | |
11 | + # - reject | |
12 | + # - grep | |
13 | + # - drop | |
14 | + # - drop_while | |
15 | + # - take_while | |
16 | + # - flat_map collect_concat | |
17 | + # - zip | |
18 | + # | |
19 | + # @mrbgem mruby-enum-lazy | |
24 | 20 | def lazy |
25 | 21 | Lazy.new(self) |
26 | 22 | end |
27 | 23 | |
24 | + # == Acknowledgements | |
25 | + # | |
26 | + # Based on https://github.com/yhara/enumerable-lazy | |
27 | + # Inspired by https://github.com/antimon2/enumerable_lz | |
28 | + # http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) | |
29 | + # | |
30 | + # @mrbgem mruby-enum-lazy | |
28 | 31 | class Lazy < Enumerator |
29 | 32 | def initialize(obj, &block) |
30 | 33 | super(){|yielder| |
@@ -84,7 +84,8 @@ | ||
84 | 84 | # # implementing an internal iterator. |
85 | 85 | # puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] } |
86 | 86 | # # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 |
87 | - | |
87 | +# | |
88 | +# @mrbgem mruby-enumerator | |
88 | 89 | class Enumerator |
89 | 90 | include Enumerable |
90 | 91 |
@@ -195,6 +195,10 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha | ||
195 | 195 | return proc; |
196 | 196 | } |
197 | 197 | |
198 | +/** | |
199 | + * | |
200 | + * @mrbgem mruby-eval | |
201 | + */ | |
198 | 202 | static mrb_value |
199 | 203 | f_eval(mrb_state *mrb, mrb_value self) |
200 | 204 | { |
@@ -221,6 +225,10 @@ mrb_value mrb_obj_instance_eval(mrb_state *mrb, mrb_value self); | ||
221 | 225 | |
222 | 226 | #define CI_ACC_SKIP -1 |
223 | 227 | |
228 | +/** | |
229 | + * | |
230 | + * @mrbgem mruby-eval | |
231 | + */ | |
224 | 232 | static mrb_value |
225 | 233 | f_instance_eval(mrb_state *mrb, mrb_value self) |
226 | 234 | { |
@@ -1,6 +1,10 @@ | ||
1 | 1 | #include <stdlib.h> |
2 | 2 | #include "mruby.h" |
3 | 3 | |
4 | +/** | |
5 | + * | |
6 | + * @mrbgem mruby-exit | |
7 | + */ | |
4 | 8 | static mrb_value |
5 | 9 | f_exit(mrb_state *mrb, mrb_value self) |
6 | 10 | { |
@@ -368,6 +368,13 @@ mrb_mruby_fiber_gem_init(mrb_state* mrb) | ||
368 | 368 | { |
369 | 369 | struct RClass *c; |
370 | 370 | |
371 | + | |
372 | + | |
373 | + /** | |
374 | + * Fiber | |
375 | + * | |
376 | + * @mrbgem mruby-fiber | |
377 | + */ | |
371 | 378 | c = mrb_define_class(mrb, "Fiber", mrb->object_class); |
372 | 379 | MRB_SET_INSTANCE_TT(c, MRB_TT_FIBER); |
373 | 380 |
@@ -380,6 +387,11 @@ mrb_mruby_fiber_gem_init(mrb_state* mrb) | ||
380 | 387 | mrb_define_class_method(mrb, c, "yield", fiber_yield, MRB_ARGS_ANY()); |
381 | 388 | mrb_define_class_method(mrb, c, "current", fiber_current, MRB_ARGS_NONE()); |
382 | 389 | |
390 | + /** | |
391 | + * FiberError | |
392 | + * | |
393 | + * @mrbgem mruby-fiber | |
394 | + */ | |
383 | 395 | mrb_define_class(mrb, "FiberError", mrb->eStandardError_class); |
384 | 396 | } |
385 | 397 |
@@ -1,6 +1,8 @@ | ||
1 | 1 | class Hash |
2 | 2 | |
3 | 3 | # ISO does not define Hash#each_pair, so each_pair is defined in gem. |
4 | + # | |
5 | + # @mrbgem mruby-hash-ext | |
4 | 6 | alias each_pair each |
5 | 7 | |
6 | 8 | ## |
@@ -22,7 +24,7 @@ class Hash | ||
22 | 24 | # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200} |
23 | 25 | # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} |
24 | 26 | # |
25 | - | |
27 | + # @mrbgem mruby-hash-ext | |
26 | 28 | def self.[](*object) |
27 | 29 | length = object.length |
28 | 30 | if length == 1 |
@@ -80,7 +82,7 @@ class Hash | ||
80 | 82 | # h1.merge!(h2) { |key, v1, v2| v1 } |
81 | 83 | # #=> {"a"=>100, "b"=>200, "c"=>300} |
82 | 84 | # |
83 | - | |
85 | + # @mrbgem mruby-hash-ext | |
84 | 86 | def merge!(other, &block) |
85 | 87 | raise TypeError, "can't convert argument into Hash" unless other.respond_to?(:to_hash) |
86 | 88 | if block |
@@ -122,7 +124,7 @@ class Hash | ||
122 | 124 | # prog.rb:2:in 'fetch': key not found (KeyError) |
123 | 125 | # from prog.rb:2 |
124 | 126 | # |
125 | - | |
127 | + # @mrbgem mruby-hash-ext | |
126 | 128 | def fetch(key, none=NONE, &block) |
127 | 129 | unless self.key?(key) |
128 | 130 | if block |
@@ -150,7 +152,7 @@ class Hash | ||
150 | 152 | # h = { "a" => 100, "b" => 200, "c" => 300 } |
151 | 153 | # h.delete_if {|key, value| key >= "b" } #=> {"a"=>100} |
152 | 154 | # |
153 | - | |
155 | + # @mrbgem mruby-hash-ext | |
154 | 156 | def delete_if(&block) |
155 | 157 | return to_enum :delete_if unless block_given? |
156 | 158 |
@@ -175,7 +177,7 @@ class Hash | ||
175 | 177 | # a.flatten # => [1, "one", 2, [2, "two"], 3, "three"] |
176 | 178 | # a.flatten(2) # => [1, "one", 2, 2, "two", 3, "three"] |
177 | 179 | # |
178 | - | |
180 | + # @mrbgem mruby-hash-ext | |
179 | 181 | def flatten(level=1) |
180 | 182 | self.to_a.flatten(level) |
181 | 183 | end |
@@ -190,7 +192,7 @@ class Hash | ||
190 | 192 | # h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 } |
191 | 193 | # h.invert #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"} |
192 | 194 | # |
193 | - | |
195 | + # @mrbgem mruby-hash-ext | |
194 | 196 | def invert |
195 | 197 | h = Hash.new |
196 | 198 | self.each {|k, v| h[v] = k } |
@@ -207,7 +209,7 @@ class Hash | ||
207 | 209 | # |
208 | 210 | # If no block is given, an enumerator is returned instead. |
209 | 211 | # |
210 | - | |
212 | + # @mrbgem mruby-hash-ext | |
211 | 213 | def keep_if(&block) |
212 | 214 | return to_enum :keep_if unless block_given? |
213 | 215 |
@@ -232,7 +234,7 @@ class Hash | ||
232 | 234 | # h.key(300) #=> "c" |
233 | 235 | # h.key(999) #=> nil |
234 | 236 | # |
235 | - | |
237 | + # @mrbgem mruby-hash-ext | |
236 | 238 | def key(val) |
237 | 239 | self.each do |k, v| |
238 | 240 | return k if v == val |
@@ -247,6 +249,7 @@ class Hash | ||
247 | 249 | # Returns +self+. If called on a subclass of Hash, converts |
248 | 250 | # the receiver to a Hash object. |
249 | 251 | # |
252 | + # @mrbgem mruby-hash-ext | |
250 | 253 | def to_h |
251 | 254 | self |
252 | 255 | end |
@@ -17,6 +17,8 @@ | ||
17 | 17 | * |
18 | 18 | * h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" } |
19 | 19 | * h.values_at("cow", "cat") #=> ["bovine", "feline"] |
20 | + * | |
21 | + * @mrbgem mruby-hash-ext | |
20 | 22 | */ |
21 | 23 | |
22 | 24 | static mrb_value |
@@ -11,6 +11,7 @@ | ||
11 | 11 | * Symbol. |
12 | 12 | * If called outside of a method, it returns <code>nil</code>. |
13 | 13 | * |
14 | + * @mrbgem mruby-kernel-ext | |
14 | 15 | */ |
15 | 16 | static mrb_value |
16 | 17 | mrb_f_method(mrb_state *mrb, mrb_value self) |
@@ -45,6 +46,8 @@ mrb_f_method(mrb_state *mrb, mrb_value self) | ||
45 | 46 | * Integer("0930", 10) #=> 930 |
46 | 47 | * Integer("111", 2) #=> 7 |
47 | 48 | * Integer(nil) #=> TypeError |
49 | + * | |
50 | + * @mrbgem mruby-kernel-ext | |
48 | 51 | */ |
49 | 52 | static mrb_value |
50 | 53 | mrb_f_integer(mrb_state *mrb, mrb_value self) |
@@ -67,6 +70,8 @@ mrb_f_integer(mrb_state *mrb, mrb_value self) | ||
67 | 70 | * Float(123.456) #=> 123.456 |
68 | 71 | * Float("123.456") #=> 123.456 |
69 | 72 | * Float(nil) #=> TypeError |
73 | + * | |
74 | + * @mrbgem mruby-kernel-ext | |
70 | 75 | */ |
71 | 76 | static mrb_value |
72 | 77 | mrb_f_float(mrb_state *mrb, mrb_value self) |
@@ -88,6 +93,8 @@ mrb_f_float(mrb_state *mrb, mrb_value self) | ||
88 | 93 | * String(self) #=> "main" |
89 | 94 | * String(self.class) #=> "Object" |
90 | 95 | * String(123456) #=> "123456" |
96 | + * | |
97 | + * @mrbgem mruby-kernel-ext | |
91 | 98 | */ |
92 | 99 | static mrb_value |
93 | 100 | mrb_f_string(mrb_state *mrb, mrb_value self) |
@@ -112,6 +119,7 @@ mrb_f_string(mrb_state *mrb, mrb_value self) | ||
112 | 119 | * |
113 | 120 | * Array(1..5) #=> [1, 2, 3, 4, 5] |
114 | 121 | * |
122 | + * @mrbgem mruby-kernel-ext | |
115 | 123 | */ |
116 | 124 | static mrb_value |
117 | 125 | mrb_f_array(mrb_state *mrb, mrb_value self) |
@@ -142,6 +150,8 @@ mrb_f_array(mrb_state *mrb, mrb_value self) | ||
142 | 150 | * Hash(nil) #=> {} |
143 | 151 | * Hash(key: :value) #=> {:key => :value} |
144 | 152 | * Hash([1, 2, 3]) #=> TypeError |
153 | + * | |
154 | + * @mrbgem mruby-kernel-ext | |
145 | 155 | */ |
146 | 156 | static mrb_value |
147 | 157 | mrb_f_hash(mrb_state *mrb, mrb_value self) |
@@ -721,6 +721,12 @@ void | ||
721 | 721 | mrb_mruby_math_gem_init(mrb_state* mrb) |
722 | 722 | { |
723 | 723 | struct RClass *mrb_math; |
724 | + | |
725 | + /** | |
726 | + * Math functions | |
727 | + * | |
728 | + * @mrbgem mruby-math | |
729 | + */ | |
724 | 730 | mrb_math = mrb_define_module(mrb, "Math"); |
725 | 731 | |
726 | 732 | mrb_define_class_under(mrb, mrb_math, "DomainError", mrb->eStandardError_class); |
@@ -1,5 +1,8 @@ | ||
1 | 1 | module Integral |
2 | + | |
3 | + # @mrbgem mruby-numeric-ext | |
2 | 4 | def div(other) |
3 | 5 | self.divmod(other)[0] |
4 | 6 | end |
7 | + | |
5 | 8 | end |
@@ -1,6 +1,9 @@ | ||
1 | 1 | #include <limits.h> |
2 | 2 | #include "mruby.h" |
3 | 3 | |
4 | +/** | |
5 | + * @mrbgem mruby-numeric-ext | |
6 | + */ | |
4 | 7 | static mrb_value |
5 | 8 | mrb_int_chr(mrb_state *mrb, mrb_value x) |
6 | 9 | { |
@@ -12,6 +12,7 @@ class Object | ||
12 | 12 | # .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"} |
13 | 13 | # .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"} |
14 | 14 | # |
15 | + # @mrbgem mruby-object-ext | |
15 | 16 | def tap |
16 | 17 | yield self |
17 | 18 | self |
@@ -7,8 +7,9 @@ | ||
7 | 7 | * nil.to_a -> [] |
8 | 8 | * |
9 | 9 | * Always returns an empty array. |
10 | + * | |
11 | + * @mrbgem mruby-object-ext | |
10 | 12 | */ |
11 | - | |
12 | 13 | static mrb_value |
13 | 14 | nil_to_a(mrb_state *mrb, mrb_value obj) |
14 | 15 | { |
@@ -20,8 +21,9 @@ nil_to_a(mrb_state *mrb, mrb_value obj) | ||
20 | 21 | * nil.to_f -> 0.0 |
21 | 22 | * |
22 | 23 | * Always returns zero. |
24 | + * | |
25 | + * @mrbgem mruby-object-ext | |
23 | 26 | */ |
24 | - | |
25 | 27 | static mrb_value |
26 | 28 | nil_to_f(mrb_state *mrb, mrb_value obj) |
27 | 29 | { |
@@ -33,8 +35,9 @@ nil_to_f(mrb_state *mrb, mrb_value obj) | ||
33 | 35 | * nil.to_i -> 0 |
34 | 36 | * |
35 | 37 | * Always returns zero. |
38 | + * | |
39 | + * @mrbgem mruby-object-ext | |
36 | 40 | */ |
37 | - | |
38 | 41 | static mrb_value |
39 | 42 | nil_to_i(mrb_state *mrb, mrb_value obj) |
40 | 43 | { |
@@ -57,8 +60,9 @@ nil_to_i(mrb_state *mrb, mrb_value obj) | ||
57 | 60 | * end |
58 | 61 | * k = KlassWithSecret.new |
59 | 62 | * k.instance_exec(5) {|x| @secret+x } #=> 104 |
63 | + * | |
64 | + * @mrbgem mruby-object-ext | |
60 | 65 | */ |
61 | - | |
62 | 66 | static mrb_value |
63 | 67 | mrb_obj_instance_exec(mrb_state *mrb, mrb_value self) |
64 | 68 | { |
@@ -174,6 +174,12 @@ os_each_object(mrb_state *mrb, mrb_value self) | ||
174 | 174 | void |
175 | 175 | mrb_mruby_objectspace_gem_init(mrb_state *mrb) |
176 | 176 | { |
177 | + | |
178 | + /** | |
179 | + * ObjectSpace | |
180 | + * | |
181 | + * @mrbgem mruby-objectspace | |
182 | + */ | |
177 | 183 | struct RClass *os = mrb_define_module(mrb, "ObjectSpace"); |
178 | 184 | mrb_define_class_method(mrb, os, "count_objects", os_count_objects, MRB_ARGS_OPT(1)); |
179 | 185 | mrb_define_class_method(mrb, os, "each_object", os_each_object, MRB_ARGS_OPT(1)); |
@@ -1,11 +1,9 @@ | ||
1 | -## | |
2 | -# Kernel | |
3 | -# | |
4 | -# ISO 15.3.1 | |
5 | 1 | module Kernel |
2 | + | |
6 | 3 | ## |
7 | 4 | # Invoke method +print+ on STDOUT and passing +*args+ |
8 | 5 | # |
6 | + # @mrbgem mruby-print | |
9 | 7 | # ISO 15.3.1.2.10 |
10 | 8 | def print(*args) |
11 | 9 | i = 0 |
@@ -19,6 +17,7 @@ module Kernel | ||
19 | 17 | ## |
20 | 18 | # Invoke method +puts+ on STDOUT and passing +*args*+ |
21 | 19 | # |
20 | + # @mrbgem mruby-print | |
22 | 21 | # ISO 15.3.1.2.11 |
23 | 22 | def puts(*args) |
24 | 23 | i = 0 |
@@ -36,6 +35,7 @@ module Kernel | ||
36 | 35 | ## |
37 | 36 | # Print human readable object description |
38 | 37 | # |
38 | + # @mrbgem mruby-print | |
39 | 39 | # ISO 15.3.1.3.34 |
40 | 40 | def p(*args) |
41 | 41 | i = 0 |
@@ -1,17 +1,21 @@ | ||
1 | 1 | class Proc |
2 | 2 | |
3 | + # @mrbgem mruby-proc-ext | |
3 | 4 | def ===(*args) |
4 | 5 | call(*args) |
5 | 6 | end |
6 | 7 | |
8 | + # @mrbgem mruby-proc-ext | |
7 | 9 | def yield(*args) |
8 | 10 | call(*args) |
9 | 11 | end |
10 | 12 | |
13 | + # @mrbgem mruby-proc-ext | |
11 | 14 | def to_proc |
12 | 15 | self |
13 | 16 | end |
14 | 17 | |
18 | + # @mrbgem mruby-proc-ext | |
15 | 19 | def curry(arity=self.arity) |
16 | 20 | type = :proc |
17 | 21 | abs = lambda {|a| a < 0 ? -a - 1 : a} |
@@ -5,6 +5,9 @@ | ||
5 | 5 | #include "mruby/string.h" |
6 | 6 | #include "mruby/debug.h" |
7 | 7 | |
8 | +/** | |
9 | + * @mrbgem mruby-proc-ext | |
10 | + */ | |
8 | 11 | static mrb_value |
9 | 12 | mrb_proc_lambda(mrb_state *mrb, mrb_value self) |
10 | 13 | { |
@@ -12,6 +15,9 @@ mrb_proc_lambda(mrb_state *mrb, mrb_value self) | ||
12 | 15 | return mrb_bool_value(MRB_PROC_STRICT_P(p)); |
13 | 16 | } |
14 | 17 | |
18 | +/** | |
19 | + * @mrbgem mruby-proc-ext | |
20 | + */ | |
15 | 21 | static mrb_value |
16 | 22 | mrb_proc_source_location(mrb_state *mrb, mrb_value self) |
17 | 23 | { |
@@ -33,6 +39,9 @@ mrb_proc_source_location(mrb_state *mrb, mrb_value self) | ||
33 | 39 | } |
34 | 40 | } |
35 | 41 | |
42 | +/** | |
43 | + * @mrbgem mruby-proc-ext | |
44 | + */ | |
36 | 45 | static mrb_value |
37 | 46 | mrb_proc_inspect(mrb_state *mrb, mrb_value self) |
38 | 47 | { |
@@ -67,6 +76,9 @@ mrb_proc_inspect(mrb_state *mrb, mrb_value self) | ||
67 | 76 | return str; |
68 | 77 | } |
69 | 78 | |
79 | +/** | |
80 | + * @mrbgem mruby-proc-ext | |
81 | + */ | |
70 | 82 | static mrb_value |
71 | 83 | mrb_kernel_proc(mrb_state *mrb, mrb_value self) |
72 | 84 | { |
@@ -88,8 +100,9 @@ mrb_kernel_proc(mrb_state *mrb, mrb_value self) | ||
88 | 100 | * |
89 | 101 | * prc = lambda{|x, y=42, *other|} |
90 | 102 | * prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]] |
103 | + * | |
104 | + * @mrbgem mruby-proc-ext | |
91 | 105 | */ |
92 | - | |
93 | 106 | static mrb_value |
94 | 107 | mrb_proc_parameters(mrb_state *mrb, mrb_value self) |
95 | 108 | { |
@@ -104,6 +104,9 @@ get_random_state(mrb_state *mrb) | ||
104 | 104 | return DATA_GET_PTR(mrb, random_val, &mt_state_type, mt_state); |
105 | 105 | } |
106 | 106 | |
107 | +/** | |
108 | + * @mrbgem mruby-random | |
109 | + */ | |
107 | 110 | static mrb_value |
108 | 111 | mrb_random_g_rand(mrb_state *mrb, mrb_value self) |
109 | 112 | { |
@@ -111,6 +114,9 @@ mrb_random_g_rand(mrb_state *mrb, mrb_value self) | ||
111 | 114 | return mrb_random_rand(mrb, random); |
112 | 115 | } |
113 | 116 | |
117 | +/** | |
118 | + * @mrbgem mruby-random | |
119 | + */ | |
114 | 120 | static mrb_value |
115 | 121 | mrb_random_g_srand(mrb_state *mrb, mrb_value self) |
116 | 122 | { |
@@ -196,8 +202,9 @@ mrb_random_srand(mrb_state *mrb, mrb_value self) | ||
196 | 202 | * ary.shuffle! -> ary |
197 | 203 | * |
198 | 204 | * Shuffles elements in self in place. |
205 | + * | |
206 | + * @mrbgem mruby-random | |
199 | 207 | */ |
200 | - | |
201 | 208 | static mrb_value |
202 | 209 | mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary) |
203 | 210 | { |
@@ -234,8 +241,9 @@ mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary) | ||
234 | 241 | * ary.shuffle -> new_ary |
235 | 242 | * |
236 | 243 | * Returns a new array with elements of self shuffled. |
244 | + * | |
245 | + * @mrbgem mruby-random | |
237 | 246 | */ |
238 | - | |
239 | 247 | static mrb_value |
240 | 248 | mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) |
241 | 249 | { |
@@ -258,8 +266,9 @@ mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) | ||
258 | 266 | * |
259 | 267 | * If the array is empty the first form returns +nil+ and the second form |
260 | 268 | * returns an empty array. |
269 | + * | |
270 | + * @mrbgem mruby-random | |
261 | 271 | */ |
262 | - | |
263 | 272 | static mrb_value |
264 | 273 | mrb_ary_sample(mrb_state *mrb, mrb_value ary) |
265 | 274 | { |
@@ -323,6 +332,9 @@ void mrb_mruby_random_gem_init(mrb_state *mrb) | ||
323 | 332 | mrb_define_method(mrb, mrb->kernel_module, "rand", mrb_random_g_rand, MRB_ARGS_OPT(1)); |
324 | 333 | mrb_define_method(mrb, mrb->kernel_module, "srand", mrb_random_g_srand, MRB_ARGS_OPT(1)); |
325 | 334 | |
335 | + /** | |
336 | + * @mrbgem mruby-random | |
337 | + */ | |
326 | 338 | random = mrb_define_class(mrb, "Random", mrb->object_class); |
327 | 339 | MRB_SET_INSTANCE_TT(random, MRB_TT_DATA); |
328 | 340 | mrb_define_class_method(mrb, random, "rand", mrb_random_g_rand, MRB_ARGS_OPT(1)); |
@@ -38,6 +38,8 @@ r_lt(mrb_state *mrb, mrb_value a, mrb_value b) | ||
38 | 38 | * ("a".."z").cover?("c") #=> true |
39 | 39 | * ("a".."z").cover?("5") #=> false |
40 | 40 | * ("a".."z").cover?("cc") #=> true |
41 | + * | |
42 | + * @mrbgem mruby-range-ext | |
41 | 43 | */ |
42 | 44 | static mrb_value |
43 | 45 | mrb_range_cover(mrb_state *mrb, mrb_value range) |
@@ -75,6 +77,8 @@ mrb_range_cover(mrb_state *mrb, mrb_value range) | ||
75 | 77 | * |
76 | 78 | * (10..20).first #=> 10 |
77 | 79 | * (10..20).first(3) #=> [10, 11, 12] |
80 | + * | |
81 | + * @mrbgem mruby-range-ext | |
78 | 82 | */ |
79 | 83 | static mrb_value |
80 | 84 | mrb_range_first(mrb_state *mrb, mrb_value range) |
@@ -106,6 +110,8 @@ mrb_range_first(mrb_state *mrb, mrb_value range) | ||
106 | 110 | * (10...20).last #=> 20 |
107 | 111 | * (10..20).last(3) #=> [18, 19, 20] |
108 | 112 | * (10...20).last(3) #=> [17, 18, 19] |
113 | + * | |
114 | + * @mrbgem mruby-range-ext | |
109 | 115 | */ |
110 | 116 | static mrb_value |
111 | 117 | mrb_range_last(mrb_state *mrb, mrb_value range) |
@@ -131,8 +137,9 @@ mrb_range_last(mrb_state *mrb, mrb_value range) | ||
131 | 137 | * |
132 | 138 | * (10..20).size #=> 11 |
133 | 139 | * ('a'..'z').size #=> nil |
140 | + * | |
141 | + * @mrbgem mruby-range-ext | |
134 | 142 | */ |
135 | - | |
136 | 143 | static mrb_value |
137 | 144 | mrb_range_size(mrb_state *mrb, mrb_value range) |
138 | 145 | { |
@@ -1,4 +1,6 @@ | ||
1 | 1 | class String |
2 | + | |
3 | + # @mrbgem mruby-sprintf | |
2 | 4 | def %(args) |
3 | 5 | if args.is_a? Array |
4 | 6 | sprintf(self, *args) |
@@ -6,6 +6,9 @@ | ||
6 | 6 | |
7 | 7 | #include "mruby.h" |
8 | 8 | |
9 | +/** | |
10 | + * @mrbgem mruby-sprintf | |
11 | + */ | |
9 | 12 | mrb_value mrb_f_sprintf(mrb_state *mrb, mrb_value obj); /* in sprintf.c */ |
10 | 13 | |
11 | 14 | void |
@@ -9,6 +9,7 @@ class String | ||
9 | 9 | # a = "abcde" |
10 | 10 | # a.clear #=> "" |
11 | 11 | # |
12 | + # @mrbgem mruby-string-ext | |
12 | 13 | def clear |
13 | 14 | self.replace("") |
14 | 15 | end |
@@ -23,6 +24,7 @@ class String | ||
23 | 24 | # " hello ".lstrip #=> "hello " |
24 | 25 | # "hello".lstrip #=> "hello" |
25 | 26 | # |
27 | + # @mrbgem mruby-string-ext | |
26 | 28 | def lstrip |
27 | 29 | a = 0 |
28 | 30 | z = self.size - 1 |
@@ -40,6 +42,7 @@ class String | ||
40 | 42 | # " hello ".rstrip #=> " hello" |
41 | 43 | # "hello".rstrip #=> "hello" |
42 | 44 | # |
45 | + # @mrbgem mruby-string-ext | |
43 | 46 | def rstrip |
44 | 47 | a = 0 |
45 | 48 | z = self.size - 1 |
@@ -56,6 +59,7 @@ class String | ||
56 | 59 | # " hello ".strip #=> "hello" |
57 | 60 | # "\tgoodbye\r\n".strip #=> "goodbye" |
58 | 61 | # |
62 | + # @mrbgem mruby-string-ext | |
59 | 63 | def strip |
60 | 64 | a = 0 |
61 | 65 | z = self.size - 1 |
@@ -75,6 +79,7 @@ class String | ||
75 | 79 | # " hello ".lstrip #=> "hello " |
76 | 80 | # "hello".lstrip! #=> nil |
77 | 81 | # |
82 | + # @mrbgem mruby-string-ext | |
78 | 83 | def lstrip! |
79 | 84 | s = self.lstrip |
80 | 85 | (s == self) ? nil : self.replace(s) |
@@ -91,6 +96,7 @@ class String | ||
91 | 96 | # " hello ".rstrip #=> " hello" |
92 | 97 | # "hello".rstrip! #=> nil |
93 | 98 | # |
99 | + # @mrbgem mruby-string-ext | |
94 | 100 | def rstrip! |
95 | 101 | s = self.rstrip |
96 | 102 | (s == self) ? nil : self.replace(s) |
@@ -103,6 +109,7 @@ class String | ||
103 | 109 | # Removes leading and trailing whitespace from <i>str</i>. Returns |
104 | 110 | # <code>nil</code> if <i>str</i> was not altered. |
105 | 111 | # |
112 | + # @mrbgem mruby-string-ext | |
106 | 113 | def strip! |
107 | 114 | s = self.strip |
108 | 115 | (s == self) ? nil : self.replace(s) |
@@ -119,6 +126,7 @@ class String | ||
119 | 126 | # "abcdef".casecmp("abcdefg") #=> -1 |
120 | 127 | # "abcdef".casecmp("ABCDEF") #=> 0 |
121 | 128 | # |
129 | + # @mrbgem mruby-string-ext | |
122 | 130 | def casecmp(str) |
123 | 131 | self.downcase <=> str.to_str.downcase |
124 | 132 | rescue NoMethodError |
@@ -136,6 +144,7 @@ class String | ||
136 | 144 | end |
137 | 145 | end |
138 | 146 | |
147 | + # @mrbgem mruby-string-ext | |
139 | 148 | def rpartition(sep) |
140 | 149 | raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String |
141 | 150 | n = rindex(sep) |
@@ -163,6 +172,7 @@ class String | ||
163 | 172 | # string.slice!("r") #=> "r" |
164 | 173 | # string #=> "thsa sting" |
165 | 174 | # |
175 | + # @mrbgem mruby-string-ext | |
166 | 176 | def slice!(arg1, arg2=nil) |
167 | 177 | raise "wrong number of arguments (for 1..2)" if arg1.nil? && arg2.nil? |
168 | 178 |
@@ -234,6 +244,7 @@ class String | ||
234 | 244 | # "abcd".insert(-3, 'X') #=> "abXcd" |
235 | 245 | # "abcd".insert(-1, 'X') #=> "abcdX" |
236 | 246 | # |
247 | + # @mrbgem mruby-string-ext | |
237 | 248 | def insert(idx, str) |
238 | 249 | pos = idx.to_i |
239 | 250 | pos += self.size + 1 if pos < 0 |
@@ -256,6 +267,8 @@ class String | ||
256 | 267 | # "hello".ljust(4) #=> "hello" |
257 | 268 | # "hello".ljust(20) #=> "hello " |
258 | 269 | # "hello".ljust(20, '1234') #=> "hello123412341234123" |
270 | + # | |
271 | + # @mrbgem mruby-string-ext | |
259 | 272 | def ljust(idx, padstr = ' ') |
260 | 273 | if idx <= self.size |
261 | 274 | return self |
@@ -297,6 +310,7 @@ class String | ||
297 | 310 | # "25".upto("5").to_a #=> [] |
298 | 311 | # "07".upto("11").to_a #=> ["07", "08", "09", "10", "11"] |
299 | 312 | # |
313 | + # @mrbgem mruby-string-ext | |
300 | 314 | def upto(other_str, excl=false, &block) |
301 | 315 | return to_enum :upto, other_str, excl unless block |
302 | 316 |
@@ -311,6 +325,7 @@ class String | ||
311 | 325 | end |
312 | 326 | end |
313 | 327 | |
328 | + # @mrbgem mruby-string-ext | |
314 | 329 | def chars(&block) |
315 | 330 | if block_given? |
316 | 331 | self.split('').map do |i| |
@@ -323,6 +338,7 @@ class String | ||
323 | 338 | end |
324 | 339 | alias each_char chars |
325 | 340 | |
341 | + # @mrbgem mruby-string-ext | |
326 | 342 | def codepoints(&block) |
327 | 343 | len = self.size |
328 | 344 |
@@ -5,6 +5,9 @@ | ||
5 | 5 | #include "mruby/string.h" |
6 | 6 | #include "mruby/range.h" |
7 | 7 | |
8 | +/** | |
9 | + * @mrbgem mruby-string-ext | |
10 | + */ | |
8 | 11 | static mrb_value |
9 | 12 | mrb_str_getbyte(mrb_state *mrb, mrb_value str) |
10 | 13 | { |
@@ -19,6 +22,9 @@ mrb_str_getbyte(mrb_state *mrb, mrb_value str) | ||
19 | 22 | return mrb_fixnum_value((unsigned char)RSTRING_PTR(str)[pos]); |
20 | 23 | } |
21 | 24 | |
25 | +/** | |
26 | + * @mrbgem mruby-string-ext | |
27 | + */ | |
22 | 28 | static mrb_value |
23 | 29 | mrb_str_setbyte(mrb_state *mrb, mrb_value str) |
24 | 30 | { |
@@ -38,6 +44,9 @@ mrb_str_setbyte(mrb_state *mrb, mrb_value str) | ||
38 | 44 | return mrb_fixnum_value((unsigned char)byte); |
39 | 45 | } |
40 | 46 | |
47 | +/** | |
48 | + * @mrbgem mruby-string-ext | |
49 | + */ | |
41 | 50 | static mrb_value |
42 | 51 | mrb_str_byteslice(mrb_state *mrb, mrb_value str) |
43 | 52 | { |
@@ -79,6 +88,8 @@ mrb_str_byteslice(mrb_state *mrb, mrb_value str) | ||
79 | 88 | * Equivalent to <code>String#swapcase</code>, but modifies the receiver in |
80 | 89 | * place, returning <i>str</i>, or <code>nil</code> if no changes were made. |
81 | 90 | * Note: case conversion is effective only in ASCII region. |
91 | + * | |
92 | + * @mrbgem mruby-string-ext | |
82 | 93 | */ |
83 | 94 | static mrb_value |
84 | 95 | mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) |
@@ -116,6 +127,8 @@ mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) | ||
116 | 127 | * |
117 | 128 | * "Hello".swapcase #=> "hELLO" |
118 | 129 | * "cYbEr_PuNk11".swapcase #=> "CyBeR_pUnK11" |
130 | + * | |
131 | + * @mrbgem mruby-string-ext | |
119 | 132 | */ |
120 | 133 | static mrb_value |
121 | 134 | mrb_str_swapcase(mrb_state *mrb, mrb_value self) |
@@ -141,6 +154,8 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self) | ||
141 | 154 | * a = "hello " |
142 | 155 | * a << "world" #=> "hello world" |
143 | 156 | * a.concat(33) #=> "hello world!" |
157 | + * | |
158 | + * @mrbgem mruby-string-ext | |
144 | 159 | */ |
145 | 160 | static mrb_value |
146 | 161 | mrb_str_concat2(mrb_state *mrb, mrb_value self) |
@@ -163,6 +178,8 @@ mrb_str_concat2(mrb_state *mrb, mrb_value self) | ||
163 | 178 | * "hello".start_with?("heaven", "hell") #=> true |
164 | 179 | * "hello".start_with?("heaven", "paradise") #=> false |
165 | 180 | * "h".start_with?("heaven", "hell") #=> false |
181 | + * | |
182 | + * @mrbgem mruby-string-ext | |
166 | 183 | */ |
167 | 184 | static mrb_value |
168 | 185 | mrb_str_start_with(mrb_state *mrb, mrb_value self) |
@@ -192,6 +209,8 @@ mrb_str_start_with(mrb_state *mrb, mrb_value self) | ||
192 | 209 | * str.end_with?([suffixes]+) -> true or false |
193 | 210 | * |
194 | 211 | * Returns true if +str+ ends with one of the +suffixes+ given. |
212 | + * | |
213 | + * @mrbgem mruby-string-ext | |
195 | 214 | */ |
196 | 215 | static mrb_value |
197 | 216 | mrb_str_end_with(mrb_state *mrb, mrb_value self) |
@@ -218,12 +237,18 @@ mrb_str_end_with(mrb_state *mrb, mrb_value self) | ||
218 | 237 | return mrb_false_value(); |
219 | 238 | } |
220 | 239 | |
240 | +/* | |
241 | + * @mrbgem mruby-string-ext | |
242 | + */ | |
221 | 243 | static mrb_value |
222 | 244 | mrb_str_hex(mrb_state *mrb, mrb_value self) |
223 | 245 | { |
224 | 246 | return mrb_str_to_inum(mrb, self, 16, FALSE); |
225 | 247 | } |
226 | 248 | |
249 | +/* | |
250 | + * @mrbgem mruby-string-ext | |
251 | + */ | |
227 | 252 | static mrb_value |
228 | 253 | mrb_str_oct(mrb_state *mrb, mrb_value self) |
229 | 254 | { |
@@ -238,6 +263,8 @@ mrb_str_oct(mrb_state *mrb, mrb_value self) | ||
238 | 263 | * |
239 | 264 | * a = "abcde" |
240 | 265 | * a.chr #=> "a" |
266 | + * | |
267 | + * @mrbgem mruby-string-ext | |
241 | 268 | */ |
242 | 269 | static mrb_value |
243 | 270 | mrb_str_chr(mrb_state *mrb, mrb_value self) |
@@ -245,6 +272,9 @@ mrb_str_chr(mrb_state *mrb, mrb_value self) | ||
245 | 272 | return mrb_str_substr(mrb, self, 0, 1); |
246 | 273 | } |
247 | 274 | |
275 | +/* | |
276 | + * @mrbgem mruby-string-ext | |
277 | + */ | |
248 | 278 | static mrb_value |
249 | 279 | mrb_fixnum_chr(mrb_state *mrb, mrb_value num) |
250 | 280 | { |
@@ -298,6 +328,8 @@ mrb_fixnum_chr(mrb_state *mrb, mrb_value num) | ||
298 | 328 | * |
299 | 329 | * a = "abc\ndef" |
300 | 330 | * a.lines #=> ["abc\n", "def"] |
331 | + * | |
332 | + * @mrbgem mruby-string-ext | |
301 | 333 | */ |
302 | 334 | static mrb_value |
303 | 335 | mrb_str_lines(mrb_state *mrb, mrb_value self) |
@@ -345,6 +377,8 @@ mrb_str_lines(mrb_state *mrb, mrb_value self) | ||
345 | 377 | * |
346 | 378 | * a = "abc" |
347 | 379 | * a.succ #=> "abd" |
380 | + * | |
381 | + * @mrbgem mruby-string-ext | |
348 | 382 | */ |
349 | 383 | static mrb_value |
350 | 384 | mrb_str_succ_bang(mrb_state *mrb, mrb_value self) |
@@ -419,6 +453,9 @@ mrb_str_succ_bang(mrb_state *mrb, mrb_value self) | ||
419 | 453 | return self; |
420 | 454 | } |
421 | 455 | |
456 | +/* | |
457 | + * @mrbgem mruby-string-ext | |
458 | + */ | |
422 | 459 | static mrb_value |
423 | 460 | mrb_str_succ(mrb_state *mrb, mrb_value self) |
424 | 461 | { |
@@ -438,6 +475,8 @@ mrb_str_succ(mrb_state *mrb, mrb_value self) | ||
438 | 475 | * a = "world" |
439 | 476 | * a.prepend("hello ") #=> "hello world" |
440 | 477 | * a #=> "hello world" |
478 | + * | |
479 | + * @mrbgem mruby-string-ext | |
441 | 480 | */ |
442 | 481 | static mrb_value |
443 | 482 | mrb_str_prepend(mrb_state *mrb, mrb_value self) |
@@ -516,6 +555,9 @@ utf8code(unsigned char* p) | ||
516 | 555 | return p[0]; |
517 | 556 | } |
518 | 557 | |
558 | +/* | |
559 | + * @mrbgem mruby-string-ext | |
560 | + */ | |
519 | 561 | static mrb_value |
520 | 562 | mrb_str_ord(mrb_state* mrb, mrb_value str) |
521 | 563 | { |
@@ -739,26 +739,28 @@ mrb_struct_values_at(mrb_state *mrb, mrb_value self) | ||
739 | 739 | |
740 | 740 | return mrb_get_values_at(mrb, self, RSTRUCT_LEN(self), argc, argv, struct_aref_int); |
741 | 741 | } |
742 | - | |
743 | -/* | |
744 | - * A <code>Struct</code> is a convenient way to bundle a number of | |
745 | - * attributes together, using accessor methods, without having to write | |
746 | - * an explicit class. | |
747 | - * | |
748 | - * The <code>Struct</code> class is a generator of specific classes, | |
749 | - * each one of which is defined to hold a set of variables and their | |
750 | - * accessors. In these examples, we'll call the generated class | |
751 | - * "<i>Customer</i>Class," and we'll show an example instance of that | |
752 | - * class as "<i>Customer</i>Inst." | |
753 | - * | |
754 | - * In the descriptions that follow, the parameter <i>symbol</i> refers | |
755 | - * to a symbol, which is either a quoted string or a | |
756 | - * <code>Symbol</code> (such as <code>:name</code>). | |
757 | - */ | |
758 | 742 | void |
759 | 743 | mrb_mruby_struct_gem_init(mrb_state* mrb) |
760 | 744 | { |
761 | 745 | struct RClass *st; |
746 | + | |
747 | + /* | |
748 | + * A <code>Struct</code> is a convenient way to bundle a number of | |
749 | + * attributes together, using accessor methods, without having to write | |
750 | + * an explicit class. | |
751 | + * | |
752 | + * The <code>Struct</code> class is a generator of specific classes, | |
753 | + * each one of which is defined to hold a set of variables and their | |
754 | + * accessors. In these examples, we'll call the generated class | |
755 | + * "<i>Customer</i>Class," and we'll show an example instance of that | |
756 | + * class as "<i>Customer</i>Inst." | |
757 | + * | |
758 | + * In the descriptions that follow, the parameter <i>symbol</i> refers | |
759 | + * to a symbol, which is either a quoted string or a | |
760 | + * <code>Symbol</code> (such as <code>:name</code>). | |
761 | + * | |
762 | + * @mrbgem mruby-struct | |
763 | + */ | |
762 | 764 | st = mrb_define_class(mrb, "Struct", mrb->object_class); |
763 | 765 | |
764 | 766 | mrb_define_class_method(mrb, st, "new", mrb_struct_s_def, MRB_ARGS_ANY()); /* 15.2.18.3.1 */ |
@@ -1,6 +1,7 @@ | ||
1 | 1 | class Symbol |
2 | 2 | include Comparable |
3 | 3 | |
4 | + # @mrbgem mruby-symbol-ext | |
4 | 5 | alias intern to_sym |
5 | 6 | |
6 | 7 | def to_proc |
@@ -14,7 +15,8 @@ class Symbol | ||
14 | 15 | # sym.capitalize -> symbol |
15 | 16 | # |
16 | 17 | # Same as <code>sym.to_s.capitalize.intern</code>. |
17 | - | |
18 | + # | |
19 | + # @mrbgem mruby-symbol-ext | |
18 | 20 | def capitalize |
19 | 21 | (self.to_s.capitalize! || self).to_sym |
20 | 22 | end |
@@ -24,7 +26,8 @@ class Symbol | ||
24 | 26 | # sym.downcase -> symbol |
25 | 27 | # |
26 | 28 | # Same as <code>sym.to_s.downcase.intern</code>. |
27 | - | |
29 | + # | |
30 | + # @mrbgem mruby-symbol-ext | |
28 | 31 | def downcase |
29 | 32 | (self.to_s.downcase! || self).to_sym |
30 | 33 | end |
@@ -34,7 +37,8 @@ class Symbol | ||
34 | 37 | # sym.upcase -> symbol |
35 | 38 | # |
36 | 39 | # Same as <code>sym.to_s.upcase.intern</code>. |
37 | - | |
40 | + # | |
41 | + # @mrbgem mruby-symbol-ext | |
38 | 42 | def upcase |
39 | 43 | (self.to_s.upcase! || self).to_sym |
40 | 44 | end |
@@ -44,7 +48,8 @@ class Symbol | ||
44 | 48 | # sym.casecmp(other) -> -1, 0, +1 or nil |
45 | 49 | # |
46 | 50 | # Case-insensitive version of <code>Symbol#<=></code>. |
47 | - | |
51 | + # | |
52 | + # @mrbgem mruby-symbol-ext | |
48 | 53 | def casecmp(other) |
49 | 54 | return nil unless other.kind_of?(Symbol) |
50 | 55 | lhs = self.to_s; lhs.upcase! |
@@ -57,7 +62,8 @@ class Symbol | ||
57 | 62 | # sym.empty? -> true or false |
58 | 63 | # |
59 | 64 | # Returns that _sym_ is :"" or not. |
60 | - | |
65 | + # | |
66 | + # @mrbgem mruby-symbol-ext | |
61 | 67 | def empty? |
62 | 68 | self.length == 0 |
63 | 69 | end |
@@ -21,6 +21,8 @@ typedef struct symbol_name { | ||
21 | 21 | * :default_proc, :compact, :extend, |
22 | 22 | * :Tms, :getwd, :$=, :ThreadGroup, |
23 | 23 | * :wait2, :$>] |
24 | + * | |
25 | + * @mrbgem mruby-symbol-ext | |
24 | 26 | */ |
25 | 27 | static mrb_value |
26 | 28 | mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) |
@@ -40,6 +42,8 @@ mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) | ||
40 | 42 | * sym.length -> integer |
41 | 43 | * |
42 | 44 | * Same as <code>sym.to_s.length</code>. |
45 | + * | |
46 | + * @mrbgem mruby-symbol-ext | |
43 | 47 | */ |
44 | 48 | static mrb_value |
45 | 49 | mrb_sym_length(mrb_state *mrb, mrb_value self) |
@@ -1,3 +1,6 @@ | ||
1 | +# Time class | |
2 | +# | |
3 | +# @mrbgem mruby-time | |
1 | 4 | class Time |
2 | 5 | def sunday?; wday == 0 end |
3 | 6 | def monday?; wday == 1 end |
@@ -1,11 +1,16 @@ | ||
1 | - | |
1 | +# @mrbgem mruby-toplevel-ext | |
2 | 2 | def self.include (*modules) |
3 | 3 | self.class.include(*modules) |
4 | 4 | end |
5 | 5 | |
6 | +# @mrbgem mruby-toplevel-ext | |
6 | 7 | def self.private(*methods) |
7 | 8 | end |
9 | + | |
10 | +# @mrbgem mruby-toplevel-ext | |
8 | 11 | def self.protected(*methods) |
9 | 12 | end |
13 | + | |
14 | +# @mrbgem mruby-toplevel-ext | |
10 | 15 | def self.public(*methods) |
11 | 16 | end |