diff --git a/include/mruby.h b/include/mruby.h index 9d90869cb..d3d96cff5 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -935,7 +935,7 @@ MRB_API struct RClass* mrb_define_module_under_id(mrb_state *mrb, struct RClass * | `I` | inline struct | void *, struct RClass | `I!` gives `NULL` for `nil` | * | `&` | block | {mrb_value} | &! raises exception if no block given. | * | `*` | rest arguments | const {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array; `*!` avoid copy of the stack. | - * | \| | optional | | After this spec following specs would be optional. | + * | `\|` | optional | | After this spec following specs would be optional. | * | `?` | optional given | {mrb_bool} | `TRUE` if preceding argument is given. Used to check optional argument is given. | * | `:` | keyword args | {mrb_kwargs} const | Get keyword arguments. @see mrb_kwargs | * diff --git a/lib/mruby/build/command.rb b/lib/mruby/build/command.rb index 773166a4f..458c166b7 100644 --- a/lib/mruby/build/command.rb +++ b/lib/mruby/build/command.rb @@ -144,13 +144,13 @@ module MRuby # # === Example of +.d+ file # - # ==== Without -MP compiler flag + # ==== Without `-MP` compiler flag # # /build/host/src/array.o: /src/array.c \ # /include/mruby/common.h /include/mruby/value.h \ # /src/value_array.h # - # ==== With -MP compiler flag + # ==== With `-MP` compiler flag # # /build/host/src/array.o: /src/array.c \ # /include/mruby/common.h /include/mruby/value.h \ diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb index d25c420e9..6758e08ea 100644 --- a/mrbgems/mruby-array-ext/mrblib/array.rb +++ b/mrbgems/mruby-array-ext/mrblib/array.rb @@ -4,8 +4,8 @@ class Array # ary.uniq! -> ary or nil # ary.uniq! { |item| ... } -> ary or nil # - # Removes duplicate elements from +self+. - # Returns nil if no changes are made (that is, no + # Removes duplicate elements from `self`. + # Returns `nil` if no changes are made (that is, no # duplicates are found). # # a = [ "a", "a", "b", "b", "c" ] @@ -42,7 +42,7 @@ class Array # ary.uniq -> new_ary # ary.uniq { |item| ... } -> new_ary # - # Returns a new array by removing duplicate values in +self+. + # Returns a new array by removing duplicate values in `self`. # # a = [ "a", "a", "b", "b", "c" ] # a.uniq #=> ["a", "b", "c"] @@ -78,15 +78,15 @@ class Array # ary.fetch(index, default) -> obj # ary.fetch(index) { |index| block } -> obj # - # Tries to return the element at position +index+, but throws an IndexError - # exception if the referenced +index+ lies outside of the array bounds. This + # Tries to return the element at position `index`, but throws an IndexError + # exception if the referenced `index` lies outside of the array bounds. This # error can be prevented by supplying a second argument, which will act as a - # +default+ value. + # `default` value. # # Alternatively, if a block is given it will only be executed when an - # invalid +index+ is referenced. + # invalid `index` is referenced. # - # Negative values of +index+ count from the end of the array. + # Negative values of `index` count from the end of the array. # # a = [ 11, 22, 33, 44 ] # a.fetch(1) #=> 22 @@ -122,17 +122,17 @@ class Array # ary.fill(start [, length] ) { |index| block } -> ary # ary.fill(range) { |index| block } -> ary # - # The first three forms set the selected elements of +self+ (which - # may be the entire array) to +obj+. + # The first three forms set the selected elements of `self` (which + # may be the entire array) to `obj`. # - # A +start+ of +nil+ is equivalent to zero. + # A `start` of `nil` is equivalent to zero. # - # A +length+ of +nil+ is equivalent to the length of the array. + # A `length` of `nil` is equivalent to the length of the array. # # The last three forms fill the array with the value of the given block, # which is passed the absolute index of each element to be filled. # - # Negative values of +start+ count from the end of the array, where +-1+ is + # Negative values of `start` count from the end of the array, where +-1+ is # the last element. # # a = [ "a", "b", "c", "d" ] @@ -174,7 +174,7 @@ class Array # ary.delete_if { |item| block } -> ary # ary.delete_if -> Enumerator # - # Deletes every element of +self+ for which block evaluates to +true+. + # Deletes every element of `self` for which block evaluates to `true`. # # The array is changed instantly every time the block is called, not after # the iteration is over. @@ -206,8 +206,8 @@ class Array # ary.reject! { |item| block } -> ary or nil # ary.reject! -> Enumerator # - # Equivalent to Array#delete_if, deleting elements from +self+ for which the - # block evaluates to +true+, but returns +nil+ if no changes were made. + # Equivalent to Array#delete_if, deleting elements from `self` for which the + # block evaluates to `true`, but returns `nil` if no changes were made. # # The array is changed instantly every time the block is called, not after # the iteration is over. @@ -349,8 +349,8 @@ class Array # ary.keep_if { |item| block } -> ary # ary.keep_if -> Enumerator # - # Deletes every element of +self+ for which the given block evaluates to - # +false+. + # Deletes every element of `self` for which the given block evaluates to + # `false`. # # See also Array#select! # @@ -379,10 +379,10 @@ class Array # ary.select! {|item| block } -> ary or nil # ary.select! -> Enumerator # - # Invokes the given block passing in successive elements from +self+, - # deleting elements for which the block returns a +false+ value. + # Invokes the given block passing in successive elements from `self`, + # deleting elements for which the block returns a `false` value. # - # If changes were made, it will return +self+, otherwise it returns +nil+. + # If changes were made, it will return `self`, otherwise it returns `nil`. # # See also Array#keep_if # @@ -409,9 +409,9 @@ class Array # call-seq: # ary.dig(idx, ...) -> object # - # Extracts the nested value specified by the sequence of idx - # objects by calling +dig+ at each step, returning +nil+ if any - # intermediate step is +nil+. + # Extracts the nested value specified by the sequence of *idx* + # objects by calling `dig` at each step, returning `nil` if any + # intermediate step is `nil`. # def dig(idx,*args) idx = idx.__to_int @@ -430,10 +430,10 @@ class Array # ary.permutation(n) { |p| block } -> ary # ary.permutation(n) -> Enumerator # - # When invoked with a block, yield all permutations of length +n+ of the + # When invoked with a block, yield all permutations of length `n` of the # elements of the array, then return the array itself. # - # If +n+ is not specified, yield all permutations of all elements. + # If `n` is not specified, yield all permutations of all elements. # # The implementation makes no guarantees about the order in which the # permutations are yielded. @@ -478,7 +478,7 @@ class Array # ary.combination(n) { |c| block } -> ary # ary.combination(n) -> Enumerator # - # When invoked with a block, yields all combinations of length +n+ of elements + # When invoked with a block, yields all combinations of length `n` of elements # from the array and then returns the array itself. # # The implementation makes no guarantees about the order in which the @@ -554,9 +554,9 @@ class Array # ary.to_h -> Hash # ary.to_h{|item| ... } -> Hash # - # Returns the result of interpreting array as an array of - # [key, value] pairs. If a block is given, it should - # return [key, value] pairs to construct a hash. + # Returns the result of interpreting *array* as an array of + # `[key, value]` pairs. If a block is given, it should + # return `[key, value]` pairs to construct a hash. # # [[:foo, :bar], [1, 2]].to_h # # => {:foo => :bar, 1 => 2} @@ -584,8 +584,8 @@ class Array # ary.fetch_values(idx, ...) { |i| block } -> array # # Returns an array containing the values associated with the given indexes. - # but also raises IndexError when one of indexes can't be found. - # Also see Array#values_at and Array#fetch. + # but also raises `IndexError` when one of indexes can't be found. + # Also see `Array#values_at` and `Array#fetch`. # # a = ["cat", "dog", "cow"] # @@ -658,7 +658,7 @@ class Array # ary.repeated_combination(n) { |combination| ... } -> self # ary.repeated_combination(n) -> enumerator # - # A +combination+ method that contains the same elements. + # A `combination` method that contains the same elements. def repeated_combination(n, &block) raise TypeError, "no implicit conversion into Integer" unless 0 <=> n return to_enum(:repeated_combination, n) unless block @@ -670,7 +670,7 @@ class Array # ary.repeated_permutation(n) { |permutation| ... } -> self # ary.repeated_permutation(n) -> enumerator # - # A +permutation+ method that contains the same elements. + # A `permutation` method that contains the same elements. def repeated_permutation(n, &block) n = n.__to_int raise TypeError, "no implicit conversion into Integer" unless 0 <=> n diff --git a/mrbgems/mruby-array-ext/src/array.c b/mrbgems/mruby-array-ext/src/array.c index 7f2492c85..65cd459ef 100644 --- a/mrbgems/mruby-array-ext/src/array.c +++ b/mrbgems/mruby-array-ext/src/array.c @@ -16,8 +16,8 @@ * using obj.==. * Returns the first contained array that matches (that * is, the first associated array), - * or +nil+ if no match is found. - * See also Array#rassoc. + * or `nil` if no match is found. + * See also `Array#rassoc`. * * s1 = [ "colors", "red", "blue", "green" ] * s2 = [ "letters", "a", "b", "c" ] @@ -49,8 +49,8 @@ ary_assoc(mrb_state *mrb, mrb_value ary) * * Searches through the array whose elements are also arrays. Compares * _obj_ with the second element of each contained array using - * ==. Returns the first contained array that matches. See - * also Array#assoc. + * `==`. Returns the first contained array that matches. See + * also `Array#assoc`. * * a = [ [ 1, "one"], [2, "two"], [3, "three"], ["ii", "two"] ] * a.rassoc("two") #=> [2, "two"] @@ -79,8 +79,8 @@ ary_rassoc(mrb_state *mrb, mrb_value ary) * ary.at(index) -> obj or nil * * Returns the element at _index_. A - * negative index counts from the end of +self+. Returns +nil+ - * if the index is out of range. See also Array#[]. + * negative index counts from the end of `self`. Returns `nil` + * if the index is out of range. See also `Array#[]`. * * a = [ "a", "b", "c", "d", "e" ] * a.at(0) #=> "a" @@ -106,8 +106,8 @@ ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n) * call-seq: * ary.values_at(selector, ...) -> new_ary * - * Returns an array containing the elements in +self+ corresponding to the - * given +selector+(s). The selectors may be either integer indices or ranges. + * Returns an array containing the elements in `self` corresponding to the + * given `selector`(s). The selectors may be either integer indices or ranges. * * a = %w{ a b c d e f } * a.values_at(1, 3, 5) # => ["b", "d", "f"] @@ -133,10 +133,10 @@ mrb_value mrb_ary_delete_at(mrb_state *mrb, mrb_value self); * ary.slice!(start, length) -> new_ary or nil * ary.slice!(range) -> new_ary or nil * - * Deletes the element(s) given by an +index+ (optionally up to +length+ - * elements) or by a +range+. + * Deletes the element(s) given by an `index` (optionally up to `length` + * elements) or by a `range`. * - * Returns the deleted object (or objects), or +nil+ if the +index+ is out of + * Returns the deleted object (or objects), or `nil` if the `index` is out of * range. * * a = [ "a", "b", "c" ] @@ -195,7 +195,7 @@ ary_slice_bang(mrb_state *mrb, mrb_value self) * call-seq: * ary.compact -> new_ary * - * Returns a copy of +self+ with all +nil+ elements removed. + * Returns a copy of `self` with all `nil` elements removed. * * [ "a", nil, "b", nil, "c", nil ].compact * #=> [ "a", "b", "c" ] @@ -220,9 +220,9 @@ ary_compact(mrb_state *mrb, mrb_value self) * call-seq: * ary.compact! -> ary or nil * - * Removes +nil+ elements from the array. - * Returns +nil+ if no changes were made, otherwise returns - * ary. + * Removes `nil` elements from the array. + * Returns `nil` if no changes were made, otherwise returns + * *ary*. * * [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ] * [ "a", "b", "c" ].compact! #=> nil @@ -252,11 +252,11 @@ ary_compact_bang(mrb_state *mrb, mrb_value self) * call-seq: * ary.rotate(count=1) -> new_ary * - * Returns a new array by rotating +self+ so that the element at +count+ is + * Returns a new array by rotating `self` so that the element at `count` is * the first element of the new array. * - * If +count+ is negative then it rotates in the opposite direction, starting - * from the end of +self+ where +-1+ is the last element. + * If `count` is negative then it rotates in the opposite direction, starting + * from the end of `self` where +-1+ is the last element. * * a = [ "a", "b", "c", "d" ] * a.rotate #=> ["b", "c", "d", "a"] @@ -304,11 +304,11 @@ rev(mrb_value *p, mrb_int beg, mrb_int end) * call-seq: * ary.rotate!(count=1) -> ary * - * Rotates +self+ in place so that the element at +count+ comes first, and - * returns +self+. + * Rotates `self` in place so that the element at `count` comes first, and + * returns `self`. * - * If +count+ is negative then it rotates in the opposite direction, starting - * from the end of the array where +-1+ is the last element. + * If `count` is negative then it rotates in the opposite direction, starting + * from the end of the array where `-1` is the last element. * * a = [ "a", "b", "c", "d" ] * a.rotate! #=> ["b", "c", "d", "a"] @@ -437,7 +437,7 @@ ary_subtract_internal(mrb_state *mrb, mrb_value self, mrb_int other_argc, const * ary - other_ary -> new_ary * * Returns a new array that is a copy of the original array, with any items - * that also appear in +other_ary+ removed. + * that also appear in `other_ary` removed. * * [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ] */ @@ -455,7 +455,7 @@ ary_sub(mrb_state *mrb, mrb_value self) * ary.difference(other_ary, ...) -> new_ary * * Returns a new array that is a copy of the original array, removing all - * occurrences of any item that also appear in any of the +other_ary+s. + * occurrences of any item that also appear in any of the `other_ary`s. * The order is preserved from the original array. * * [1, 2, 3, 4, 5].difference([2, 4], [1, 5]) #=> [3] @@ -547,7 +547,7 @@ ary_union_internal(mrb_state *mrb, mrb_value self, mrb_int argc, const mrb_value * ary | other_ary -> new_ary * * Set Union---Returns a new array by joining this array with - * *other_ary*, removing duplicates. + * `other_ary`, removing duplicates. * * [ "a", "b", "c" ] | [ "c", "d", "a" ] * #=> [ "a", "b", "c", "d" ] @@ -566,7 +566,7 @@ ary_union(mrb_state *mrb, mrb_value self) * ary.union(other_ary,...) -> new_ary * * Set Union---Returns a new array by joining this array with - * other_arys, removing duplicates. + * `other_ary`s, removing duplicates. * * ["a", "b", "c"].union(["c", "d", "a"], ["a", "c", "e"]) * #=> ["a", "b", "c", "d", "e"] @@ -683,7 +683,7 @@ ary_intersection(mrb_state *mrb, mrb_value self) * ary.intersection(other_ary,...) -> new_ary * * Set Intersection---Returns a new array containing elements common to - * this array and other_arys, removing duplicates. The order is + * this array and `other_ary`s, removing duplicates. The order is * preserved from the original array. * * [1, 2, 3].intersection([3, 4, 1], [1, 3, 5]) #=> [1, 3] @@ -702,8 +702,8 @@ ary_intersection_multi(mrb_state *mrb, mrb_value self) * call-seq: * ary.intersect?(other_ary) -> true or false * - * Returns +true+ if the array and +other_ary+ have at least one element in - * common, otherwise returns +false+. + * Returns `true` if the array and `other_ary` have at least one element in + * common, otherwise returns `false`. * * a = [ 1, 2, 3 ] * b = [ 3, 4, 5 ] @@ -1064,7 +1064,7 @@ flatten_internal(mrb_state *mrb, mrb_value self, mrb_int level, mrb_bool *modifi * Returns a new array that is a one-dimensional flattening of this * array (recursively). That is, for every element that is an array, * extract its elements into the new array. If the optional - * level argument determines the level of recursion to flatten. + * `level` argument determines the level of recursion to flatten. * * s = [ 1, 2, 3 ] #=> [1, 2, 3] * t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] @@ -1157,10 +1157,9 @@ ary_fetch(mrb_state *mrb, mrb_value self) * ary.flatten! -> ary or nil * ary.flatten!(level) -> array or nil * - * Flattens +self+ in place. - * Returns nil if no modifications were made (i.e., - * ary contains no subarrays.) If the optional level - * argument determines the level of recursion to flatten. + * Flattens `self` in place. Returns `nil` if no modifications were made + * (i.e., *ary* contains no subarrays.) If the optional `level` argument + * determines the level of recursion to flatten. * * a = [ 1, 2, [3, [4, 5] ] ] * a.flatten! #=> [1, 2, 3, 4, 5] diff --git a/mrbgems/mruby-cmath/src/cmath.c b/mrbgems/mruby-cmath/src/cmath.c index 684de5bc7..b4b70fbce 100644 --- a/mrbgems/mruby-cmath/src/cmath.c +++ b/mrbgems/mruby-cmath/src/cmath.c @@ -145,9 +145,9 @@ cmath_ ## name(mrb_state *mrb, mrb_value self)\ * call-seq: * CMath.exp(z) -> numeric * - * Returns the exponential of +z+. - * If +z+ is a complex number, returns a complex result. - * If +z+ is real and positive, returns a float. + * Returns the exponential of `z`. + * If `z` is a complex number, returns a complex result. + * If `z` is real and positive, returns a float. * * CMath.exp(1) #=> 2.718281828459045 * CMath.exp(1+1i) #=> (1.4686939399158851+2.2873552871788423i) @@ -159,8 +159,8 @@ DEF_CMATH_METHOD(exp) * CMath.log(z) -> numeric * CMath.log(z, base) -> numeric * - * Returns the natural logarithm of +z+. - * If a second argument +base+ is given, returns the logarithm of +z+ to the given base. + * Returns the natural logarithm of `z`. + * If a second argument `base` is given, returns the logarithm of `z` to the given base. * Has a branch cut along the negative real axis. * * CMath.log(1) #=> 0.0 @@ -194,7 +194,7 @@ cmath_log(mrb_state *mrb, mrb_value self) { * call-seq: * CMath.log10(z) -> numeric * - * Returns the base-10 logarithm of +z+. + * Returns the base-10 logarithm of `z`. * Has a branch cut along the negative real axis. * * CMath.log10(100) #=> 2.0 @@ -216,7 +216,7 @@ cmath_log10(mrb_state *mrb, mrb_value self) { * call-seq: * CMath.log2(z) -> numeric * - * Returns the base-2 logarithm of +z+. + * Returns the base-2 logarithm of `z`. * Has a branch cut along the negative real axis. * * CMath.log2(8) #=> 3.0 @@ -238,7 +238,7 @@ cmath_log2(mrb_state *mrb, mrb_value self) { * call-seq: * CMath.sqrt(z) -> numeric * - * Returns the square root of +z+. + * Returns the square root of `z`. * Has a branch cut along the negative real axis. * * CMath.sqrt(4) #=> 2.0 @@ -260,7 +260,7 @@ cmath_sqrt(mrb_state *mrb, mrb_value self) { * call-seq: * CMath.sin(z) -> numeric * - * Returns the sine of +z+. + * Returns the sine of `z`. * * CMath.sin(0) #=> 0.0 * CMath.sin(1i) #=> (0.0+1.1752011936438014i) @@ -271,7 +271,7 @@ DEF_CMATH_METHOD(sin) * call-seq: * CMath.cos(z) -> numeric * - * Returns the cosine of +z+. + * Returns the cosine of `z`. * * CMath.cos(0) #=> 1.0 * CMath.cos(1i) #=> (1.5430806348152437+0.0i) @@ -282,7 +282,7 @@ DEF_CMATH_METHOD(cos) * call-seq: * CMath.tan(z) -> numeric * - * Returns the tangent of +z+. + * Returns the tangent of `z`. * * CMath.tan(0) #=> 0.0 * CMath.tan(1i) #=> (0.0+0.7615941559557649i) @@ -292,7 +292,7 @@ DEF_CMATH_METHOD(tan) * call-seq: * CMath.asin(z) -> numeric * - * Returns the arc sine of +z+. + * Returns the arc sine of `z`. * * CMath.asin(0) #=> 0.0 * CMath.asin(2) #=> (1.5707963267948966-1.3169578969248166i) @@ -303,7 +303,7 @@ DEF_CMATH_METHOD(asin) * call-seq: * CMath.acos(z) -> numeric * - * Returns the arc cosine of +z+. + * Returns the arc cosine of `z`. * * CMath.acos(1) #=> 0.0 * CMath.acos(2) #=> (0.0+1.3169578969248166i) @@ -314,7 +314,7 @@ DEF_CMATH_METHOD(acos) * call-seq: * CMath.atan(z) -> numeric * - * Returns the arc tangent of +z+. + * Returns the arc tangent of `z`. * * CMath.atan(0) #=> 0.0 * CMath.atan(1i) #=> (0.0+Infinity*i) @@ -324,7 +324,7 @@ DEF_CMATH_METHOD(atan) * call-seq: * CMath.sinh(z) -> numeric * - * Returns the hyperbolic sine of +z+. + * Returns the hyperbolic sine of `z`. * * CMath.sinh(0) #=> 0.0 * CMath.sinh(1i) #=> (0.0+0.8414709848078965i) @@ -335,7 +335,7 @@ DEF_CMATH_METHOD(sinh) * call-seq: * CMath.cosh(z) -> numeric * - * Returns the hyperbolic cosine of +z+. + * Returns the hyperbolic cosine of `z`. * * CMath.cosh(0) #=> 1.0 * CMath.cosh(1i) #=> (0.5403023058681398+0.0i) @@ -346,7 +346,7 @@ DEF_CMATH_METHOD(cosh) * call-seq: * CMath.tanh(z) -> numeric * - * Returns the hyperbolic tangent of +z+. + * Returns the hyperbolic tangent of `z`. * * CMath.tanh(0) #=> 0.0 * CMath.tanh(1i) #=> (0.0+1.557407724654902i) @@ -356,7 +356,7 @@ DEF_CMATH_METHOD(tanh) * call-seq: * CMath.asinh(z) -> numeric * - * Returns the inverse hyperbolic sine of +z+. + * Returns the inverse hyperbolic sine of `z`. * * CMath.asinh(0) #=> 0.0 * CMath.asinh(1i) #=> (0.0+1.5707963267948966i) @@ -367,7 +367,7 @@ DEF_CMATH_METHOD(asinh) * call-seq: * CMath.acosh(z) -> numeric * - * Returns the inverse hyperbolic cosine of +z+. + * Returns the inverse hyperbolic cosine of `z`. * Has a branch cut at values less than 1. * * CMath.acosh(1) #=> 0.0 @@ -379,7 +379,7 @@ DEF_CMATH_METHOD(acosh) * call-seq: * CMath.atanh(z) -> numeric * - * Returns the inverse hyperbolic tangent of +z+. + * Returns the inverse hyperbolic tangent of `z`. * Has branch cuts at values less than -1 and greater than 1. * * CMath.atanh(0) #=> 0.0 diff --git a/mrbgems/mruby-compar-ext/mrblib/compar.rb b/mrbgems/mruby-compar-ext/mrblib/compar.rb index ba17d84c8..4a82cd448 100644 --- a/mrbgems/mruby-compar-ext/mrblib/compar.rb +++ b/mrbgems/mruby-compar-ext/mrblib/compar.rb @@ -4,9 +4,9 @@ module Comparable # obj.clamp(min, max) -> obj # obj.clamp(range) -> obj # - # In (min, max) form, returns _min_ if _obj_ - # <=> _min_ is less than zero, _max_ if _obj_ - # <=> _max_ is greater than zero, and _obj_ + # In `(min, max)` form, returns _min_ if _obj_ + # `<=>` _min_ is less than zero, _max_ if _obj_ + # `<=>` _max_ is greater than zero, and _obj_ # otherwise. # # 12.clamp(0, 100) #=> 12 @@ -16,9 +16,9 @@ module Comparable # 'd'.clamp('a', 'f') #=> 'd' # 'z'.clamp('a', 'f') #=> 'f' # - # In (range) form, returns _range.begin_ if _obj_ - # <=> _range.begin_ is less than zero, _range.end_ - # if _obj_ <=> _range.end_ is greater than zero, and + # In `(range)` form, returns _range.begin_ if _obj_ + # `<=>` _range.begin_ is less than zero, _range.end_ + # if _obj_ `<=>` _range.end_ is greater than zero, and # _obj_ otherwise. # # 12.clamp(0..100) #=> 12 @@ -28,14 +28,14 @@ module Comparable # 'd'.clamp('a'..'f') #=> 'd' # 'z'.clamp('a'..'f') #=> 'f' # - # If _range.begin_ is +nil+, it is considered smaller than _obj_, - # and if _range.end_ is +nil+, it is considered greater than + # If _range.begin_ is `nil`, it is considered smaller than _obj_, + # and if _range.end_ is `nil`, it is considered greater than # _obj_. # # -20.clamp(0..) #=> 0 # 523.clamp(..100) #=> 100 # - # When _range.end_ is excluded and not +nil+, an exception is + # When _range.end_ is excluded and not `nil`, an exception is # raised. # # 100.clamp(0...100) # ArgumentError diff --git a/mrbgems/mruby-data/src/data.c b/mrbgems/mruby-data/src/data.c index f07046003..704c7d0c9 100644 --- a/mrbgems/mruby-data/src/data.c +++ b/mrbgems/mruby-data/src/data.c @@ -269,12 +269,12 @@ make_data_class(mrb_state *mrb, mrb_value members, struct RClass *klass) * call-seq: * DataClass.define(arg, ...) -> obj * - * Data::define returns a new Class object, + * `Data::define` returns a new `Class` object, * which can then be used to create specific instances of the new * data structure. The number of actual parameters must be * equal to the number of attributes defined for this class. * Passing too many or too less parameters will raise an - * ArgumentError. + * `ArgumentError`. * * The remaining methods listed in this section (class and instance) * are defined for this generated class. @@ -379,10 +379,10 @@ mrb_data_init_copy(mrb_state *mrb, mrb_value copy) * call-seq: * data == other_data -> true or false * - * Equality---Returns true if other_data is + * Equality---Returns `true` if *other_data* is * equal to this one: they must be of the same class as generated by - * Data::define, and all values of must be equal - * (according to Object#==). + * `Data::define`, and all values of must be equal + * (according to `Object#==`). * * Customer = Data.define(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) @@ -425,7 +425,7 @@ mrb_data_equal(mrb_state *mrb, mrb_value s) * data.eql?(other) -> true or false * * Two structures are equal if they are the same object, or if all their - * fields are equal (using Object#eql?). + * fields are equal (using `Object#eql?`). */ static mrb_value mrb_data_eql(mrb_state *mrb, mrb_value s) @@ -510,18 +510,18 @@ mrb_data_to_s(mrb_state *mrb, mrb_value self) } /* - * A Data is a convenient way to bundle a number of + * A `Data` is a convenient way to bundle a number of * attributes together, using accessor methods, without having to write * an explicit class. * - * The Data class is a generator of specific classes, + * The `Data` class is a generator of specific classes, * each one of which is defined to hold a set of variables and their * accessors. In these examples, we'll call the generated class - * "CustomerClass," and we'll show an example instance of that - * class as "CustomerInst." + * "*Customer*Class," and we'll show an example instance of that + * class as "*Customer*Inst." * - * In the descriptions that follow, the parameter symbol refers - * to a symbol (such as :name). + * In the descriptions that follow, the parameter *symbol* refers + * to a symbol (such as `:name`). */ void mrb_mruby_data_gem_init(mrb_state* mrb) diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index 985199abe..424a7055d 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -6,7 +6,7 @@ module Enumerable # call-seq: # enum.drop(n) -> array # - # Drops first n elements from enum, and returns rest elements + # Drops first n elements from *enum*, and returns rest elements # in an array. # # a = [1, 2, 3, 4, 5, 0] @@ -27,7 +27,7 @@ module Enumerable # enum.drop_while -> an_enumerator # # Drops elements up to, but not including, the first element for - # which the block returns +nil+ or +false+ and returns an array + # which the block returns `nil` or `false` and returns an array # containing the remaining elements. # # If no block is given, an enumerator is returned instead. @@ -50,7 +50,7 @@ module Enumerable # call-seq: # enum.take(n) -> array # - # Returns first n elements from enum. + # Returns first n elements from *enum*. # # a = [1, 2, 3, 4, 5, 0] # a.take(3) #=> [1, 2, 3] @@ -74,7 +74,7 @@ module Enumerable # enum.take_while {|arr| block } -> array # enum.take_while -> an_enumerator # - # Passes elements to the block until the block returns +nil+ or +false+, + # Passes elements to the block until the block returns `nil` or `false`, # then stops iterating and returns an array of all prior elements. # # If no block is given, an enumerator is returned instead. @@ -163,7 +163,7 @@ module Enumerable # enum.group_by -> an_enumerator # # Returns a hash, which keys are evaluated result from the - # block, and values are arrays of elements in enum + # block, and values are arrays of elements in *enum* # corresponding to the key. # # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} @@ -185,8 +185,8 @@ module Enumerable # enum.sort_by { |obj| block } -> array # enum.sort_by -> an_enumerator # - # Sorts enum using a set of keys generated by mapping the - # values in enum through the given block. + # Sorts *enum* using a set of keys generated by mapping the + # values in *enum* through the given block. # # If no block is given, an enumerator is returned instead. def sort_by(&block) @@ -199,8 +199,8 @@ module Enumerable # enum.first -> obj or nil # enum.first(n) -> an_array # - # Returns the first element, or the first +n+ elements, of the enumerable. - # If the enumerable is empty, the first form returns nil, and the + # Returns the first element, or the first `n` elements, of the enumerable. + # If the enumerable is empty, the first form returns `nil`, and the # second form returns an empty array. def first(*args) case args.length @@ -231,9 +231,9 @@ module Enumerable # enum.count(item) -> int # enum.count { |obj| block } -> int # - # Returns the number of items in +enum+ through enumeration. - # If an argument is given, the number of items in +enum+ that - # are equal to +item+ are counted. If a block is given, it + # Returns the number of items in `enum` through enumeration. + # If an argument is given, the number of items in `enum` that + # are equal to `item` are counted. If a block is given, it # counts the number of elements yielding a true value. def count(v=NONE, &block) count = 0 @@ -261,7 +261,7 @@ module Enumerable # enum.collect_concat -> an_enumerator # # Returns a new array with the concatenated results of running - # block once for every element in enum. + # block once for every element in *enum*. # # If no block is given, an enumerator is returned instead. # @@ -288,7 +288,7 @@ module Enumerable # enum.max_by {|obj| block } -> obj # enum.max_by -> an_enumerator # - # Returns the object in enum that gives the maximum + # Returns the object in *enum* that gives the maximum # value from the given block. # # If no block is given, an enumerator is returned instead. @@ -322,7 +322,7 @@ module Enumerable # enum.min_by {|obj| block } -> obj # enum.min_by -> an_enumerator # - # Returns the object in enum that gives the minimum + # Returns the object in *enum* that gives the minimum # value from the given block. # # If no block is given, an enumerator is returned instead. @@ -358,7 +358,7 @@ module Enumerable # # Returns two elements array which contains the minimum and the # maximum value in the enumerable. The first form assumes all - # objects implement Comparable; the second uses the + # objects implement `Comparable`; the second uses the # block to return a <=> b. # # a = %w(albatross dog horse) @@ -396,7 +396,7 @@ module Enumerable # enum.minmax_by -> an_enumerator # # Returns a two element array containing the objects in - # enum that correspond to the minimum and maximum values respectively + # *enum* that correspond to the minimum and maximum values respectively # from the given block. # # If no block is given, an enumerator is returned instead. @@ -437,12 +437,12 @@ module Enumerable # enum.none?(pattern) -> true or false # # Passes each element of the collection to the given block. The method - # returns true if the block never returns true - # for all elements. If the block is not given, none? will return - # true only if none of the collection members is true. + # returns `true` if the block never returns `true` + # for all elements. If the block is not given, `none?` will return + # `true` only if none of the collection members is true. # # If a pattern is supplied instead, the method returns whether - # pattern === element for none of the collection members. + # `pattern === element` for none of the collection members. # # %w(ant bear cat).none? { |word| word.length == 5 } #=> true # %w(ant bear cat).none? { |word| word.length >= 4 } #=> false @@ -475,13 +475,13 @@ module Enumerable # enum.one?(pattern) -> true or false # # Passes each element of the collection to the given block. The method - # returns true if the block returns true - # exactly once. If the block is not given, one? will return - # true only if exactly one of the collection members is + # returns `true` if the block returns `true` + # exactly once. If the block is not given, `one?` will return + # `true` only if exactly one of the collection members is # true. # # If a pattern is supplied instead, the method returns whether - # pattern === element for exactly one collection member. + # `pattern === element` for exactly one collection member. # # %w(ant bear cat).one? { |word| word.length == 4 } #=> true # %w(ant bear cat).one? { |word| word.length > 4 } #=> false @@ -520,14 +520,14 @@ module Enumerable # enum.all?(pattern) -> true or false # # Passes each element of the collection to the given block. The method - # returns true if the block never returns - # false or nil. If the block is not given, - # Ruby adds an implicit block of { |obj| obj } which will - # cause #all? to return +true+ when none of the collection members are - # +false+ or +nil+. + # returns `true` if the block never returns + # `false` or `nil`. If the block is not given, + # Ruby adds an implicit block of `{ |obj| obj }` which will + # cause #all? to return `true` when none of the collection members are + # `false` or `nil`. # # If a pattern is supplied instead, the method returns whether - # pattern === element for every collection member. + # `pattern === element` for every collection member. # # %w[ant bear cat].all? { |word| word.length >= 3 } #=> true # %w[ant bear cat].all? { |word| word.length >= 4 } #=> false @@ -552,14 +552,14 @@ module Enumerable # enum.any?(pattern) -> true or false # # Passes each element of the collection to the given block. The method - # returns true if the block ever returns a value other - # than false or nil. If the block is not - # given, Ruby adds an implicit block of { |obj| obj } that - # will cause #any? to return +true+ if at least one of the collection - # members is not +false+ or +nil+. + # returns `true` if the block ever returns a value other + # than `false` or `nil`. If the block is not + # given, Ruby adds an implicit block of `{ |obj| obj }` that + # will cause #any? to return `true` if at least one of the collection + # members is not `false` or `nil`. # # If a pattern is supplied instead, the method returns whether - # pattern === element for any collection member. + # `pattern === element` for any collection member. # # %w[ant bear cat].any? { |word| word.length >= 3 } #=> true # %w[ant bear cat].any? { |word| word.length >= 4 } #=> true @@ -635,13 +635,13 @@ module Enumerable # enum.cycle(n=nil) { |obj| block } -> nil # enum.cycle(n=nil) -> an_enumerator # - # Calls block for each element of enum repeatedly _n_ - # times or forever if none or +nil+ is given. If a non-positive + # Calls *block* for each element of *enum* repeatedly _n_ + # times or forever if none or `nil` is given. If a non-positive # number is given or the collection is empty, does nothing. Returns - # +nil+ if the loop has finished without getting interrupted. + # `nil` if the loop has finished without getting interrupted. # # Enumerable#cycle saves elements in an internal array so changes - # to enum after the first pass have no effect. + # to *enum* after the first pass have no effect. # # If no block is given, an enumerator is returned instead. # @@ -684,10 +684,10 @@ module Enumerable # enum.find_index { |obj| block } -> int or nil # enum.find_index -> an_enumerator # - # Compares each entry in enum with value or passes + # Compares each entry in *enum* with value or passes # to block. Returns the index for the first for which the # evaluated value is non-false. If no object matches, returns - # nil + # `nil` # # If neither block nor argument is given, an enumerator is returned instead. # @@ -719,12 +719,12 @@ module Enumerable # enum.zip(arg, ...) -> an_array_of_array # enum.zip(arg, ...) { |arr| block } -> nil # - # Takes one element from enum and merges corresponding - # elements from each args. This generates a sequence of + # Takes one element from *enum* and merges corresponding + # elements from each *args*. This generates a sequence of # n-element arrays, where n is one more than the # count of arguments. The length of the resulting sequence will be - # enum#size. If the size of any argument is less than - # enum#size, nil values are supplied. If + # `enum#size`. If the size of any argument is less than + # `enum#size`, `nil` values are supplied. If # a block is given, it is invoked for each output array, otherwise # an array of arrays is returned. # @@ -773,8 +773,8 @@ module Enumerable # call-seq: # enum.to_h -> hash # - # Returns the result of interpreting enum as a list of - # [key, value] pairs. + # Returns the result of interpreting *enum* as a list of + # `[key, value]` pairs. # # %i[hello world].each_with_index.to_h # # => {:hello => 0, :world => 1} diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index baf0cbbe9..81bed7644 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -96,7 +96,7 @@ class Enumerator # # In the first form, iteration is defined by the given block, in # which a "yielder" object, given as block parameter, can be used to - # yield a value by calling the +yield+ method (aliased as +<<+): + # yield a value by calling the `yield` method (aliased as +<<+): # # fib = Enumerator.new do |y| # a = b = 1 @@ -158,10 +158,10 @@ class Enumerator # e.with_index(offset = 0) # # Iterates the given block for each element with an index, which - # starts from +offset+. If no block is given, returns a new Enumerator - # that includes the index, starting from +offset+ + # starts from `offset`. If no block is given, returns a new Enumerator + # that includes the index, starting from `offset` # - # +offset+:: the starting index to use + # `offset`:: the starting index to use # def with_index(offset=0, &block) return to_enum :with_index, offset unless block @@ -199,8 +199,8 @@ class Enumerator # e.with_object(obj) {|(*args), obj| ... } # e.with_object(obj) # - # Iterates the given block for each element with an arbitrary object, +obj+, - # and returns +obj+ + # Iterates the given block for each element with an arbitrary object, `obj`, + # and returns `obj` # # If no block is given, returns a new Enumerator. # @@ -339,7 +339,7 @@ class Enumerator # p e.next #=> 3 # p e.next #raises StopIteration # - # Note that enumeration sequence by +next+ does not affect other non-external + # Note that enumeration sequence by `next` does not affect other non-external # enumeration methods, unless the underlying iteration methods itself has # side-effect # @@ -355,8 +355,8 @@ class Enumerator # internal position forward. When the position reached at the end, # StopIteration is raised. # - # This method can be used to distinguish yield and yield - # nil. + # This method can be used to distinguish `yield` and `yield + # nil`. # # === Example # @@ -388,7 +388,7 @@ class Enumerator # # yield nil [nil] nil # # yield [1, 2] [[1, 2]] [1, 2] # - # Note that +next_values+ does not affect other non-external enumeration + # Note that `next_values` does not affect other non-external enumeration # methods unless underlying iteration method itself has side-effect # def next_values @@ -510,7 +510,7 @@ class Enumerator # call-seq: # e.feed obj -> nil # - # Sets the value to be returned by the next yield inside +e+. + # Sets the value to be returned by the next yield inside `e`. # # If the value is not set, the yield returns nil. # @@ -596,9 +596,9 @@ class Enumerator # # Creates an infinite enumerator from any block, just called over and # over. Result of the previous iteration is passed to the next one. - # If +initial+ is provided, it is passed to the first iteration, and + # If `initial` is provided, it is passed to the first iteration, and # becomes the first element of the enumerator; if it is not provided, - # first iteration receives +nil+, and its result becomes first + # first iteration receives `nil`, and its result becomes first # element of the iterator. # # Raising StopIteration from the block stops an iteration. @@ -637,8 +637,8 @@ module Kernel # obj.to_enum(method = :each, *args) -> enum # obj.enum_for(method = :each, *args) -> enum # - # Creates a new Enumerator which will enumerate by calling +method+ on - # +obj+, passing +args+ if any. + # Creates a new Enumerator which will enumerate by calling `method` on + # `obj`, passing `args` if any. # # === Examples # @@ -748,14 +748,14 @@ module Enumerable # e.next # => [2, [6, 7, 8]] # e.next # => [3, [9, 10]] # - # You can use the special symbol :_alone to force an element + # You can use the special symbol `:_alone` to force an element # into its own separate chuck: # # a = [0, 0, 1, 1] # e = a.chunk{|i| i.even? ? :_alone : true } # e.to_a # => [[:_alone, [0]], [:_alone, [0]], [true, [1, 1]]] # - # You can use the special symbol :_separator or +nil+ + # You can use the special symbol `:_separator` or `nil` # to force an element to be ignored (not included in any chunk): # # a = [0, 0, -1, 1, 1] @@ -801,17 +801,17 @@ module Enumerable # _elt_before_ and _elt_after_, # in the receiver enumerator. # This method split chunks between _elt_before_ and _elt_after_ where - # the block returns false. + # the block returns `false`. # # The block is called the length of the receiver enumerator minus one. # # The result enumerator yields the chunked elements as an array. - # So +each+ method can be called as follows: + # So `each` method can be called as follows: # # enum.chunk_while { |elt_before, elt_after| bool }.each { |ary| ... } # # Other methods of the Enumerator class and Enumerable module, - # such as +to_a+, +map+, etc., are also usable. + # such as `to_a`, `map`, etc., are also usable. # # For example, one-by-one increasing subsequence can be chunked as follows: # @@ -837,7 +837,7 @@ module Enumerable # #=> [[7, 5, 9], [2, 0], [7, 9], [4, 2, 0]] # # Enumerable#slice_when does the same, except splitting when the block - # returns true instead of false. + # returns `true` instead of `false`. # def chunk_while(&block) enum = self diff --git a/mrbgems/mruby-exit/src/mruby_exit.c b/mrbgems/mruby-exit/src/mruby_exit.c index 3e3a56232..7ba153a54 100644 --- a/mrbgems/mruby-exit/src/mruby_exit.c +++ b/mrbgems/mruby-exit/src/mruby_exit.c @@ -32,7 +32,7 @@ get_status(mrb_state *mrb) * optional parameter is used to return a status code to the invoking * environment. * - * +true+ and +false+ of _status_ means success and failure + * `true` and `false` of _status_ means success and failure * respectively. The interpretation of other integer values are * system dependent. * diff --git a/mrbgems/mruby-fiber/src/fiber.c b/mrbgems/mruby-fiber/src/fiber.c index a31c4a524..0a65828d1 100644 --- a/mrbgems/mruby-fiber/src/fiber.c +++ b/mrbgems/mruby-fiber/src/fiber.c @@ -79,10 +79,10 @@ init_fiber(mrb_state *mrb, struct RFiber *f, const struct RProc *p) * Fiber.new{...} -> obj * * Creates a fiber, whose execution is suspended until it is explicitly - * resumed using Fiber#resume method. + * resumed using `Fiber#resume` method. * The code running inside the fiber can give up control by calling - * Fiber.yield in which case it yields control back to caller - * (the caller of the Fiber#resume). + * `Fiber.yield` in which case it yields control back to caller + * (the caller of the `Fiber#resume`). * * Upon yielding or termination the Fiber returns the value of the last * executed expression @@ -104,10 +104,10 @@ init_fiber(mrb_state *mrb, struct RFiber *f, const struct RProc *p) * 2 * resuming dead fiber (FiberError) * - * The Fiber#resume method accepts an arbitrary number of - * parameters, if it is the first call to resume then they + * The `Fiber#resume` method accepts an arbitrary number of + * parameters, if it is the first call to `resume` then they * will be passed as block arguments. Otherwise they will be the return - * value of the call to Fiber.yield + * value of the call to `Fiber.yield` * * Example: * @@ -306,16 +306,16 @@ fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mr * call-seq: * fiber.resume(args, ...) -> obj * - * Resumes the fiber from the point at which the last Fiber.yield + * Resumes the fiber from the point at which the last `Fiber.yield` * was called, or starts running it if it is the first call to - * resume. Arguments passed to resume will be the value of - * the Fiber.yield expression or will be passed as block - * parameters to the fiber's block if this is the first resume. + * `resume`. Arguments passed to resume will be the value of + * the `Fiber.yield` expression or will be passed as block + * parameters to the fiber's block if this is the first `resume`. * * Alternatively, when resume is called it evaluates to the arguments passed - * to the next Fiber.yield statement inside the fiber's block + * to the next `Fiber.yield` statement inside the fiber's block * or to the block value if it runs to completion without any - * Fiber.yield + * `Fiber.yield` */ static mrb_value fiber_resume(mrb_state *mrb, mrb_value self) @@ -425,12 +425,12 @@ fiber_to_s(mrb_state *mrb, mrb_value self) * fiber.transfer(args, ...) -> obj * * Transfers control to receiver fiber of the method call. - * Unlike resume the receiver wouldn't be pushed to call + * Unlike `resume` the receiver wouldn't be pushed to call * stack of fibers. Instead it will switch to the call stack of * transferring fiber. * When resuming a fiber that was transferred to another fiber it would * cause double resume error. Though when the fiber is re-transferred - * and Fiber.yield is called, the fiber would be resumable. + * and `Fiber.yield` is called, the fiber would be resumable. */ static mrb_value fiber_transfer(mrb_state *mrb, mrb_value self) @@ -493,14 +493,14 @@ mrb_fiber_yield(mrb_state *mrb, mrb_int len, const mrb_value *a) * * Yields control back to the context that resumed the fiber, passing * along any arguments that were passed to it. The fiber will resume - * processing at this point when resume is called next. - * Any arguments passed to the next resume will be the + * processing at this point when `resume` is called next. + * Any arguments passed to the next `resume` will be the * * mruby limitation: Fiber resume/yield cannot cross C function boundary. * thus you cannot yield from #initialize which is called by mrb_funcall(). * - * This method cannot be called from C using mrb_funcall(). - * Use mrb_fiber_yield() function instead. + * This method cannot be called from C using `mrb_funcall()`. + * Use `mrb_fiber_yield()` function instead. */ static mrb_value fiber_yield(mrb_state *mrb, mrb_value self) diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 97e1031f9..dbebb82d6 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -79,7 +79,7 @@ class Hash # # Returns a value from the hash for the given key. If the key can't be # found, there are several options: With no other arguments, it will - # raise an KeyError exception; if default is + # raise an `KeyError` exception; if *default* is # given, then that will be returned; if the optional code block is # specified, then that will be run and its result returned. # @@ -119,8 +119,8 @@ class Hash # hsh.delete_if {| key, value | block } -> hsh # hsh.delete_if -> an_enumerator # - # Deletes every key-value pair from hsh for which block - # evaluates to true. + # Deletes every key-value pair from *hsh* for which *block* + # evaluates to `true`. # # If no block is given, an enumerator is returned instead. # @@ -146,7 +146,7 @@ class Hash # hash. That is, for every key or value that is an array, extract # its elements into the new array. Unlike Array#flatten, this # method does not flatten recursively by default. The optional - # level argument determines the level of recursion to flatten. + # *level* argument determines the level of recursion to flatten. # # a = {1=> "one", 2 => [2,"two"], 3 => "three"} # a.flatten # => [1, "one", 2, [2, "two"], 3, "three"] @@ -161,7 +161,7 @@ class Hash # call-seq: # hsh.invert -> new_hash # - # Returns a new hash created by using hsh's values as keys, and + # Returns a new hash created by using *hsh*'s values as keys, and # the keys as values. # # h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 } @@ -179,7 +179,7 @@ class Hash # hsh.keep_if {| key, value | block } -> hsh # hsh.keep_if -> an_enumerator # - # Deletes every key-value pair from hsh for which block + # Deletes every key-value pair from *hsh* for which *block* # evaluates to false. # # If no block is given, an enumerator is returned instead. @@ -201,7 +201,7 @@ class Hash # call-seq: # hsh.to_h -> hsh or new_hash # - # Returns +self+. If called on a subclass of Hash, converts + # Returns `self`. If called on a subclass of Hash, converts # the receiver to a Hash object. # def to_h @@ -212,8 +212,8 @@ class Hash # call-seq: # hash < other -> true or false # - # Returns true if hash is subset of - # other. + # Returns `true` if *hash* is subset of + # *other*. # # h1 = {a:1, b:2} # h2 = {a:1, b:2, c:3} @@ -232,8 +232,8 @@ class Hash # call-seq: # hash <= other -> true or false # - # Returns true if hash is subset of - # other or equals to other. + # Returns `true` if *hash* is subset of + # *other* or equals to *other*. # # h1 = {a:1, b:2} # h2 = {a:1, b:2, c:3} @@ -252,8 +252,8 @@ class Hash # call-seq: # hash > other -> true or false # - # Returns true if other is subset of - # hash. + # Returns `true` if *other* is subset of + # *hash*. # # h1 = {a:1, b:2} # h2 = {a:1, b:2, c:3} @@ -272,8 +272,8 @@ class Hash # call-seq: # hash >= other -> true or false # - # Returns true if other is subset of - # hash or equals to hash. + # Returns `true` if *other* is subset of + # *hash* or equals to *hash*. # # h1 = {a:1, b:2} # h2 = {a:1, b:2, c:3} @@ -292,9 +292,9 @@ class Hash # call-seq: # hsh.dig(key,...) -> object # - # Extracts the nested value specified by the sequence of key - # objects by calling +dig+ at each step, returning +nil+ if any - # intermediate step is +nil+. + # Extracts the nested value specified by the sequence of *key* + # objects by calling `dig` at each step, returning `nil` if any + # intermediate step is `nil`. # def dig(idx,*args) n = self[idx] @@ -329,8 +329,8 @@ class Hash # hsh.transform_keys! {|key| block } -> hsh # hsh.transform_keys! -> an_enumerator # - # Invokes the given block once for each key in hsh, replacing it - # with the new key returned by the block, and then returns hsh. + # Invokes the given block once for each key in *hsh*, replacing it + # with the new key returned by the block, and then returns *hsh*. # # If no block is given, an enumerator is returned instead. # @@ -366,7 +366,7 @@ class Hash # hsh.transform_values! -> an_enumerator # # Invokes the given block once for each value in the hash, replacing - # with the new value returned by the block, and then returns hsh. + # with the new value returned by the block, and then returns *hsh*. # # If no block is given, an enumerator is returned instead. # @@ -388,8 +388,8 @@ class Hash # hsh.fetch_values(key, ...) { |key| block } -> array # # Returns an array containing the values associated with the given keys - # but also raises KeyError when one of keys can't be found. - # Also see Hash#values_at and Hash#fetch. + # but also raises `KeyError` when one of keys can't be found. + # Also see `Hash#values_at` and `Hash#fetch`. # # h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" } # diff --git a/mrbgems/mruby-hash-ext/src/hash_ext.c b/mrbgems/mruby-hash-ext/src/hash_ext.c index 4b63e4844..098fb9d47 100644 --- a/mrbgems/mruby-hash-ext/src/hash_ext.c +++ b/mrbgems/mruby-hash-ext/src/hash_ext.c @@ -15,7 +15,7 @@ * hsh.values_at(key, ...) -> array * * Return an array containing the values associated with the given keys. - * Also see Hash.select. + * Also see `Hash.select`. * * h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" } * h.values_at("cow", "cat") #=> ["bovine", "feline"] @@ -105,7 +105,7 @@ slice_bang_i(mrb_state *mrb, mrb_value key, mrb_value val, void *data) * call-seq: * hsh.slice!(*keys) -> a_hash * - * Deletes keys from hsh that are not in +keys+. + * Deletes keys from hsh that are not in `keys`. * Returns a new hash containing the deleted key-value pairs. * * h = { a: 1, b: 2, c: 3, d: 4 } @@ -309,7 +309,7 @@ hash_key_i(mrb_state *mrb, mrb_value key, mrb_value val, void *data) * hsh.key(value) -> key * * Returns the key of an occurrence of a given value. If the value is - * not found, returns nil. + * not found, returns `nil`. * * h = { "a" => 100, "b" => 200, "c" => 300, "d" => 300 } * h.key(200) #=> "b" diff --git a/mrbgems/mruby-io/src/file_test.c b/mrbgems/mruby-io/src/file_test.c index b04b5d2fb..ec076906d 100644 --- a/mrbgems/mruby-io/src/file_test.c +++ b/mrbgems/mruby-io/src/file_test.c @@ -110,7 +110,9 @@ mrb_filetest_s_directory_p(mrb_state *mrb, mrb_value klass) * call-seq: * File.pipe?(file_name) -> true or false * - * Returns true if the named file is a pipe. + * Returns `true` if the named file is a pipe. + * + * File.pipe?("/dev/stdin") #=> true */ static mrb_value @@ -141,7 +143,9 @@ mrb_filetest_s_pipe_p(mrb_state *mrb, mrb_value klass) * call-seq: * File.symlink?(file_name) -> true or false * - * Returns true if the named file is a symbolic link. + * Returns `true` if the named file is a symbolic link. + * + * File.symlink?("link-to-test") #=> true */ static mrb_value @@ -182,7 +186,9 @@ mrb_filetest_s_symlink_p(mrb_state *mrb, mrb_value klass) * call-seq: * File.socket?(file_name) -> true or false * - * Returns true if the named file is a socket. + * Returns `true` if the named file is a socket. + * + * File.socket?("/tmp/.X11-unix/X0") #=> true */ static mrb_value @@ -224,7 +230,10 @@ mrb_filetest_s_socket_p(mrb_state *mrb, mrb_value klass) * File.exist?(file_name) -> true or false * File.exists?(file_name) -> true or false * - * Return true if the named file exists. + * Returns `true` if the named file exists. + * + * File.exist?("config.h") #=> true + * File.exist?("no_such_file") #=> false */ static mrb_value @@ -243,8 +252,9 @@ mrb_filetest_s_exist_p(mrb_state *mrb, mrb_value klass) * call-seq: * File.file?(file_name) -> true or false * - * Returns true if the named file exists and is a - * regular file. + * Returns `true` if the named file exists and is a regular file. + * + * File.file?("testfile") #=> true */ static mrb_value @@ -269,8 +279,9 @@ mrb_filetest_s_file_p(mrb_state *mrb, mrb_value klass) * call-seq: * File.zero?(file_name) -> true or false * - * Returns true if the named file exists and has - * a zero size. + * Returns `true` if the named file exists and has a zero size. + * + * File.zero?("testfile") #=> false */ static mrb_value @@ -291,9 +302,11 @@ mrb_filetest_s_zero_p(mrb_state *mrb, mrb_value klass) * call-seq: * File.size(file_name) -> integer * - * Returns the size of file_name. + * Returns the size of `file_name`. * - * _file_name_ can be an IO object. + * `file_name` can be an IO object. + * + * File.size("testfile") #=> 66 */ static mrb_value @@ -312,8 +325,10 @@ mrb_filetest_s_size(mrb_state *mrb, mrb_value klass) * call-seq: * File.size?(file_name) -> Integer or nil * - * Returns +nil+ if +file_name+ doesn't exist or has zero size, the size of the + * Returns `nil` if `file_name` doesn't exist or has zero size, the size of the * file otherwise. + * + * File.size?("testfile") #=> 66 */ static mrb_value diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c index bd056db7d..d2f0783be 100644 --- a/mrbgems/mruby-kernel-ext/src/kernel.c +++ b/mrbgems/mruby-kernel-ext/src/kernel.c @@ -92,7 +92,7 @@ mrb_f_caller(mrb_state *mrb, mrb_value self) * __method__ -> symbol * * Returns the called name of the current method as a Symbol. - * If called outside of a method, it returns nil. + * If called outside of a method, it returns `nil`. * */ static mrb_value @@ -113,7 +113,7 @@ mrb_f_method(mrb_state *mrb, mrb_value self) * __callee__ -> symbol * * Returns the called name of the current method as a Symbol. - * If called outside of a method, it returns nil. + * If called outside of a method, it returns `nil`. * */ static mrb_value @@ -131,16 +131,16 @@ mrb_f_callee(mrb_state *mrb, mrb_value self) * call-seq: * Integer(arg,base=0) -> integer * - * Converts arg to a Integer. + * Converts *arg* to a `Integer`. * Numeric types are converted directly (with floating-point numbers - * being truncated). base (0, or between 2 and 36) is a base for - * integer string representation. If arg is a String, - * when base is omitted or equals to zero, radix indicators - * (0, 0b, and 0x) are honored. + * being truncated). *base* (0, or between 2 and 36) is a base for + * integer string representation. If *arg* is a `String`, + * when *base* is omitted or equals to zero, radix indicators + * (`0`, `0b`, and `0x`) are honored. * In any case, strings should be strictly conformed to numeric * representation. This behavior is different from that of - * String#to_i. Non string values will be treated as integers. - * Passing nil raises a TypeError. + * `String#to_i`. Non string values will be treated as integers. + * Passing `nil` raises a TypeError. * * Integer(123.999) #=> 123 * Integer("0x1a") #=> 26 @@ -196,8 +196,8 @@ arg_error: * call-seq: * Float(arg) -> float * - * Returns arg converted to a float. Numeric types are converted - * directly, the rest are converted using arg.to_f. + * Returns *arg* converted to a float. Numeric types are converted + * directly, the rest are converted using *arg*.to_f. * * Float(1) #=> 1.0 * Float(123.456) #=> 123.456 @@ -220,8 +220,8 @@ mrb_f_float(mrb_state *mrb, mrb_value self) * call-seq: * String(arg) -> string * - * Returns arg as an String. - * converted using to_s method. + * Returns *arg* as an `String`. + * converted using `to_s` method. * * String(self) #=> "main" * String(self.class) #=> "Object" @@ -241,7 +241,7 @@ mrb_f_string(mrb_state *mrb, mrb_value self) * call-seq: * Array(arg) -> array * - * Returns +arg+ as an Array using to_a method. + * Returns `arg` as an Array using to_a method. * * Array(1..5) #=> [1, 2, 3, 4, 5] * @@ -264,9 +264,9 @@ mrb_f_array(mrb_state *mrb, mrb_value self) * call-seq: * Hash(arg) -> hash * - * Returns a Hash if arg is a Hash. - * Returns an empty Hash when arg is nil - * or []. + * Returns a `Hash` if *arg* is a `Hash`. + * Returns an empty `Hash` when *arg* is `nil` + * or `[]`. * * Hash([]) #=> {} * Hash(nil) #=> {} diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index 0d2f4cc48..a02d0b2fd 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -184,7 +184,7 @@ log2(double x) * call-seq: * Math.sin(x) -> float * - * Computes the sine of x (expressed in radians). Returns + * Computes the sine of *x* (expressed in radians). Returns * -1..1. */ static mrb_value @@ -198,7 +198,7 @@ math_sin(mrb_state *mrb, mrb_value obj) * call-seq: * Math.cos(x) -> float * - * Computes the cosine of x (expressed in radians). Returns + * Computes the cosine of *x* (expressed in radians). Returns * -1..1. */ static mrb_value @@ -212,7 +212,7 @@ math_cos(mrb_state *mrb, mrb_value obj) * call-seq: * Math.tan(x) -> float * - * Returns the tangent of x (expressed in radians). + * Returns the tangent of *x* (expressed in radians). */ static mrb_value math_tan(mrb_state *mrb, mrb_value obj) @@ -229,7 +229,7 @@ math_tan(mrb_state *mrb, mrb_value obj) * call-seq: * Math.asin(x) -> float * - * Computes the arc sine of x. + * Computes the arc sine of *x*. * @return computed value between `-(PI/2)` and `(PI/2)`. */ static mrb_value @@ -249,7 +249,7 @@ math_asin(mrb_state *mrb, mrb_value obj) * call-seq: * Math.acos(x) -> float * - * Computes the arc cosine of x. Returns 0..PI. + * Computes the arc cosine of *x*. Returns 0..PI. */ static mrb_value math_acos(mrb_state *mrb, mrb_value obj) @@ -268,7 +268,7 @@ math_acos(mrb_state *mrb, mrb_value obj) * call-seq: * Math.atan(x) -> float * - * Computes the arc tangent of x. Returns `-(PI/2) .. (PI/2)`. + * Computes the arc tangent of *x*. Returns `-(PI/2) .. (PI/2)`. */ static mrb_value math_atan(mrb_state *mrb, mrb_value obj) @@ -281,7 +281,7 @@ math_atan(mrb_state *mrb, mrb_value obj) * call-seq: * Math.atan2(y, x) -> float * - * Computes the arc tangent given y and x. Returns + * Computes the arc tangent given *y* and *x*. Returns * -PI..PI. * * Math.atan2(-0.0, -1.0) #=> -3.141592653589793 @@ -314,7 +314,7 @@ math_atan2(mrb_state *mrb, mrb_value obj) * call-seq: * Math.sinh(x) -> float * - * Computes the hyperbolic sine of x (expressed in + * Computes the hyperbolic sine of *x* (expressed in * radians). */ static mrb_value @@ -328,7 +328,7 @@ math_sinh(mrb_state *mrb, mrb_value obj) * call-seq: * Math.cosh(x) -> float * - * Computes the hyperbolic cosine of x (expressed in radians). + * Computes the hyperbolic cosine of *x* (expressed in radians). */ static mrb_value math_cosh(mrb_state *mrb, mrb_value obj) @@ -341,7 +341,7 @@ math_cosh(mrb_state *mrb, mrb_value obj) * call-seq: * Math.tanh() -> float * - * Computes the hyperbolic tangent of x (expressed in + * Computes the hyperbolic tangent of *x* (expressed in * radians). */ static mrb_value @@ -360,7 +360,7 @@ math_tanh(mrb_state *mrb, mrb_value obj) * call-seq: * Math.asinh(x) -> float * - * Computes the inverse hyperbolic sine of x. + * Computes the inverse hyperbolic sine of *x*. */ static mrb_value math_asinh(mrb_state *mrb, mrb_value obj) @@ -373,7 +373,7 @@ math_asinh(mrb_state *mrb, mrb_value obj) * call-seq: * Math.acosh(x) -> float * - * Computes the inverse hyperbolic cosine of x. + * Computes the inverse hyperbolic cosine of *x*. */ static mrb_value math_acosh(mrb_state *mrb, mrb_value obj) @@ -392,7 +392,7 @@ math_acosh(mrb_state *mrb, mrb_value obj) * call-seq: * Math.atanh(x) -> float * - * Computes the inverse hyperbolic tangent of x. + * Computes the inverse hyperbolic tangent of *x*. */ static mrb_value math_atanh(mrb_state *mrb, mrb_value obj) @@ -434,7 +434,7 @@ math_exp(mrb_state *mrb, mrb_value obj) * Math.log(numeric) -> float * Math.log(num,base) -> float * - * Returns the natural logarithm of numeric. + * Returns the natural logarithm of *numeric*. * If additional second argument is given, it will be the base * of logarithm. * @@ -468,7 +468,7 @@ math_log(mrb_state *mrb, mrb_value obj) * call-seq: * Math.log2(numeric) -> float * - * Returns the base 2 logarithm of numeric. + * Returns the base 2 logarithm of *numeric*. * * Math.log2(1) #=> 0.0 * Math.log2(2) #=> 1.0 @@ -493,7 +493,7 @@ math_log2(mrb_state *mrb, mrb_value obj) * call-seq: * Math.log10(numeric) -> float * - * Returns the base 10 logarithm of numeric. + * Returns the base 10 logarithm of *numeric*. * * Math.log10(1) #=> 0.0 * Math.log10(10) #=> 1.0 @@ -517,7 +517,7 @@ math_log10(mrb_state *mrb, mrb_value obj) * call-seq: * Math.sqrt(numeric) -> float * - * Returns the square root of numeric. + * Returns the square root of *numeric*. * */ static mrb_value @@ -538,7 +538,7 @@ math_sqrt(mrb_state *mrb, mrb_value obj) * call-seq: * Math.cbrt(numeric) -> float * - * Returns the cube root of numeric. + * Returns the cube root of *numeric*. * * -9.upto(9) {|x| * p [x, Math.cbrt(x), Math.cbrt(x)**3] @@ -578,8 +578,8 @@ math_cbrt(mrb_state *mrb, mrb_value obj) * Math.frexp(numeric) -> [ fraction, exponent ] * * Returns a two-element array containing the normalized fraction (a - * Float) and exponent (a Integer) of - * numeric. + * `Float`) and exponent (a `Integer`) of + * *numeric*. * * fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11] * fraction * 2**exponent #=> 1234.0 @@ -599,7 +599,7 @@ math_frexp(mrb_state *mrb, mrb_value obj) * call-seq: * Math.ldexp(flt, int) -> float * - * Returns the value of flt*(2**int). + * Returns the value of *flt**(2***int*). * * fraction, exponent = Math.frexp(1234) * Math.ldexp(fraction, exponent) #=> 1234.0 @@ -621,7 +621,7 @@ math_ldexp(mrb_state *mrb, mrb_value obj) * Math.hypot(x, y) -> float * * Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle - * with sides x and y. + * with sides *x* and *y*. * * Math.hypot(3, 4) #=> 5.0 */ diff --git a/mrbgems/mruby-metaprog/src/metaprog.c b/mrbgems/mruby-metaprog/src/metaprog.c index 7d4bd8f74..a7d0d6469 100644 --- a/mrbgems/mruby-metaprog/src/metaprog.c +++ b/mrbgems/mruby-metaprog/src/metaprog.c @@ -25,8 +25,8 @@ mrb_f_nil(mrb_state *mrb, mrb_value cv) * call-seq: * obj.instance_variable_defined?(symbol) -> true or false * - * Returns true if the given instance variable is - * defined in obj. + * Returns `true` if the given instance variable is + * defined in *obj*. * * class Fred * def initialize(p1, p2) @@ -54,9 +54,9 @@ mrb_obj_ivar_defined(mrb_state *mrb, mrb_value self) * obj.instance_variable_get(symbol) -> obj * * Returns the value of the given instance variable, or nil if the - * instance variable is not set. The @ part of the + * instance variable is not set. The `@` part of the * variable name should be included for regular instance - * variables. Throws a NameError exception if the + * variables. Throws a `NameError` exception if the * supplied symbol is not valid as an instance variable name. * * class Fred @@ -83,8 +83,8 @@ mrb_obj_ivar_get(mrb_state *mrb, mrb_value self) * call-seq: * obj.instance_variable_set(symbol, obj) -> obj * - * Sets the instance variable names by symbol to - * object, thereby frustrating the efforts of the class's + * Sets the instance variable names by *symbol* to + * *object*, thereby frustrating the efforts of the class's * author to attempt to provide proper encapsulation. The variable * did not have to exist prior to this call. * @@ -234,8 +234,8 @@ mrb_obj_methods_m(mrb_state *mrb, mrb_value self) * call-seq: * obj.private_methods(all=true) -> array * - * Returns the list of private methods accessible to obj. If - * the all parameter is set to false, only those methods + * Returns the list of private methods accessible to *obj*. If + * the *all* parameter is set to `false`, only those methods * in the receiver will be listed. */ static mrb_value @@ -249,8 +249,8 @@ mrb_obj_private_methods(mrb_state *mrb, mrb_value self) * call-seq: * obj.protected_methods(all=true) -> array * - * Returns the list of protected methods accessible to obj. If - * the all parameter is set to false, only those methods + * Returns the list of protected methods accessible to *obj*. If + * the *all* parameter is set to `false`, only those methods * in the receiver will be listed. */ static mrb_value @@ -264,8 +264,8 @@ mrb_obj_protected_methods(mrb_state *mrb, mrb_value self) * call-seq: * obj.public_methods(all=true) -> array * - * Returns the list of public methods accessible to obj. If - * the all parameter is set to false, only those methods + * Returns the list of public methods accessible to *obj*. If + * the *all* parameter is set to `false`, only those methods * in the receiver will be listed. */ static mrb_value @@ -308,9 +308,9 @@ mrb_obj_singleton_methods(mrb_state *mrb, mrb_bool recur, mrb_value obj) * call-seq: * obj.singleton_methods(all=true) -> array * - * Returns an array of the names of singleton methods for obj. - * If the optional all parameter is true, the list will include - * methods in modules included in obj. + * Returns an array of the names of singleton methods for *obj*. + * If the optional *all* parameter is true, the list will include + * methods in modules included in *obj*. * Only public and protected singleton methods are returned. * * module Other @@ -374,7 +374,7 @@ check_cv_name_sym(mrb_state *mrb, mrb_sym id) * call-seq: * remove_class_variable(sym) -> obj * - * Removes the definition of the sym, returning that + * Removes the definition of the *sym*, returning that * constant's value. * * class Dummy @@ -419,8 +419,8 @@ mrb_mod_remove_cvar(mrb_state *mrb, mrb_value mod) * call-seq: * obj.class_variable_defined?(symbol) -> true or false * - * Returns true if the given class variable is defined - * in obj. + * Returns `true` if the given class variable is defined + * in *obj*. * * class Fred * @@foo = 99 @@ -445,7 +445,7 @@ mrb_mod_cvar_defined(mrb_state *mrb, mrb_value mod) * mod.class_variable_get(symbol) -> obj * * Returns the value of the given class variable (or throws a - * NameError exception). The @@ part of the + * `NameError` exception). The `@@` part of the * variable name should be included for regular class variables * * class Fred @@ -469,8 +469,8 @@ mrb_mod_cvar_get(mrb_state *mrb, mrb_value mod) * call-seq: * obj.class_variable_set(symbol, obj) -> obj * - * Sets the class variable names by symbol to - * object. + * Sets the class variable names by *symbol* to + * *object*. * * class Fred * @@foo = 99 @@ -532,9 +532,9 @@ mod_instance_methods(mrb_state *mrb, mrb_value mod, unsigned int visibility) * Returns an array containing the names of the public and protected instance * methods in the receiver. For a module, these are the public and protected methods; * for a class, they are the instance (not singleton) methods. With no - * argument, or with an argument that is false, the - * instance methods in mod are returned, otherwise the methods - * in mod and mod's superclasses are returned. + * argument, or with an argument that is `false`, the + * instance methods in *mod* are returned, otherwise the methods + * in *mod* and *mod*'s superclasses are returned. * * module A * def method1() end @@ -615,7 +615,7 @@ mrb_mod_undefined_methods(mrb_state *mrb, mrb_value mod) * remove_method(symbol) -> self * * Removes the method identified by _symbol_ from the current - * class. For an example, see Module.undef_method. + * class. For an example, see `Module.undef_method`. */ static mrb_value diff --git a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb index 0ace87e8c..c121fdec2 100644 --- a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +++ b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb @@ -3,7 +3,7 @@ class Numeric # call-seq: # zero? -> true or false # - # Returns +true+ if +zero+ has a zero value, +false+ otherwise. + # Returns `true` if `zero` has a zero value, `false` otherwise. # # Of the Core and Standard Library classes, # only Rational and Complex use this implementation. @@ -16,8 +16,8 @@ class Numeric # call-seq: # nonzero? -> self or nil # - # Returns +self+ if +self+ is not a zero value, +nil+ otherwise; - # uses method zero? for the evaluation. + # Returns `self` if `self` is not a zero value, `nil` otherwise; + # uses method `zero?` for the evaluation. # def nonzero? if self == 0 @@ -31,7 +31,7 @@ class Numeric # call-seq: # positive? -> true or false # - # Returns +true+ if +self+ is greater than 0, +false+ otherwise. + # Returns `true` if `self` is greater than 0, `false` otherwise. # def positive? self > 0 @@ -41,7 +41,7 @@ class Numeric # call-seq: # negative? -> true or false # - # Returns +true+ if +self+ is less than 0, +false+ otherwise. + # Returns `true` if `self` is less than 0, `false` otherwise. # def negative? self < 0 @@ -66,7 +66,7 @@ class Integer # call-seq: # int.allbits?(mask) -> true or false # - # Returns +true+ if all bits of +int+ & +mask+ are 1. + # Returns `true` if all bits of ``int` & `mask`` are 1. # def allbits?(mask) (self & mask) == mask @@ -76,7 +76,7 @@ class Integer # call-seq: # int.anybits?(mask) -> true or false # - # Returns +true+ if any bits of +int+ & +mask+ are 1. + # Returns `true` if any bits of ``int` & `mask`` are 1. # def anybits?(mask) (self & mask) != 0 @@ -86,7 +86,7 @@ class Integer # call-seq: # int.nobits?(mask) -> true or false # - # Returns +true+ if no bits of +int+ & +mask+ are 1. + # Returns `true` if no bits of ``int` & `mask`` are 1. # def nobits?(mask) (self & mask) == 0 @@ -95,7 +95,7 @@ class Integer # call-seq: # ceildiv(other) -> integer # - # Returns the result of division +self+ by +other+. The + # Returns the result of division `self` by `other`. The # result is rounded up to the nearest integer. # # 3.ceildiv(3) # => 1 diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c index 5acc29ded..2366414c6 100644 --- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c +++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c @@ -12,7 +12,7 @@ static mrb_value flo_remainder(mrb_state *mrb, mrb_value self); * call-seq: * num.remainder(numeric) -> real * - * x.remainder(y) means x-y*(x/y).truncate. + * `x.remainder(y)` means `x-y*(x/y).truncate`. * * See Numeric#divmod. */ @@ -209,15 +209,15 @@ int_powm(mrb_state *mrb, mrb_value x) * call-seq: * digits(base = 10) -> array_of_integers * - * Returns an array of integers representing the +base+-radix - * digits of +self+; + * Returns an array of integers representing the `base`-radix + * digits of `self`; * the first element of the array represents the least significant digit: * * 12345.digits # => [5, 4, 3, 2, 1] * 12345.digits(7) # => [4, 6, 6, 0, 5] * 12345.digits(100) # => [45, 23, 1] * - * Raises an exception if +self+ is negative or +base+ is less than 2. + * Raises an exception if `self` is negative or `base` is less than 2. * */ @@ -315,7 +315,7 @@ int_size(mrb_state *mrb, mrb_value self) * call-seq: * int.even? -> true or false * - * Returns +true+ if +int+ is an even number. + * Returns `true` if `int` is an even number. */ static mrb_value int_even(mrb_state *mrb, mrb_value self) @@ -334,7 +334,7 @@ int_even(mrb_state *mrb, mrb_value self) * call-seq: * int.odd? -> true or false * - * Returns +true+ if +int+ is an odd number. + * Returns `true` if `int` is an odd number. */ static mrb_value int_odd(mrb_state *mrb, mrb_value self) @@ -349,7 +349,7 @@ int_odd(mrb_state *mrb, mrb_value self) * call-seq: * num.remainder(numeric) -> real * - * x.remainder(y) means x-y*(x/y).truncate. + * `x.remainder(y)` means `x-y*(x/y).truncate`. * * See Numeric#divmod. */ @@ -393,7 +393,7 @@ isqrt(mrb_int n) * call-seq: * Integer.sqrt(n) -> integer * - * Returns the integer square root of the non-negative integer +n+, + * Returns the integer square root of the non-negative integer `n`, * which is the largest integer `i` such that `i*i <= n`. * * Integer.sqrt(0) # => 0 diff --git a/mrbgems/mruby-object-ext/mrblib/object.rb b/mrbgems/mruby-object-ext/mrblib/object.rb index f014df469..e7e60692e 100644 --- a/mrbgems/mruby-object-ext/mrblib/object.rb +++ b/mrbgems/mruby-object-ext/mrblib/object.rb @@ -3,7 +3,7 @@ module Kernel # obj.yield_self {|_obj|...} -> an_object # obj.then {|_obj|...} -> an_object # - # Yields obj and returns the result. + # Yields *obj* and returns the result. # # 'my string'.yield_self {|s|s.upcase} #=> "MY STRING" # @@ -17,7 +17,7 @@ module Kernel # call-seq: # obj.tap{|x|...} -> obj # - # Yields x to the block, and then returns x. + # Yields `x` to the block, and then returns `x`. # The primary purpose of this method is to "tap into" a method chain, # in order to perform operations on intermediate results within the chain. # diff --git a/mrbgems/mruby-object-ext/src/object.c b/mrbgems/mruby-object-ext/src/object.c index 4efb96edf..0aeba480e 100644 --- a/mrbgems/mruby-object-ext/src/object.c +++ b/mrbgems/mruby-object-ext/src/object.c @@ -66,7 +66,7 @@ nil_to_i(mrb_state *mrb, mrb_value obj) * call-seq: * obj.itself -> an_object * - * Returns obj. + * Returns *obj*. * * string = 'my string' #=> "my string" * string.itself.object_id == string.object_id #=> true @@ -78,7 +78,7 @@ nil_to_i(mrb_state *mrb, mrb_value obj) * obj.instance_exec(arg...) {|var...| block } -> obj * * Executes the given block within the context of the receiver - * (_obj_). In order to set the context, the variable +self+ is set + * (_obj_). In order to set the context, the variable `self` is set * to _obj_ while the code is executing, giving the code access to * _obj_'s instance variables. Arguments are passed as block parameters. * diff --git a/mrbgems/mruby-objectspace/src/mruby_objectspace.c b/mrbgems/mruby-objectspace/src/mruby_objectspace.c index 4c7708111..0d30e7f64 100644 --- a/mrbgems/mruby-objectspace/src/mruby_objectspace.c +++ b/mrbgems/mruby-objectspace/src/mruby_objectspace.c @@ -50,7 +50,7 @@ os_count_object_type(mrb_state *mrb, struct RBasic *obj, void *data) * # ... * } * - * If the optional argument +result_hash+ is given, + * If the optional argument `result_hash` is given, * it is overwritten and returned. This is intended to avoid probe effect. * */ @@ -157,9 +157,9 @@ os_each_object_cb(mrb_state *mrb, struct RBasic *obj, void *ud) * * Calls the block once for each object in this Ruby process. * Returns the number of objects found. - * If the optional argument +module+ is given, + * If the optional argument `module` is given, * calls the block for only those classes or modules - * that match (or are a subclass of) +module+. + * that match (or are a subclass of) `module`. * * If no block is given, ArgumentError is raised. * diff --git a/mrbgems/mruby-proc-ext/src/proc.c b/mrbgems/mruby-proc-ext/src/proc.c index 3fbce8bce..7d9bb21dd 100644 --- a/mrbgems/mruby-proc-ext/src/proc.c +++ b/mrbgems/mruby-proc-ext/src/proc.c @@ -10,9 +10,9 @@ * call-seq: * prc.lambda? -> true or false * - * Returns +true+ if +prc+ is a lambda, +false+ if it is a proc. - * The difference is how they react to a +return+ statement. In a lambda, - * +return+ makes the lambda return. In a proc, +return+ makes the method + * Returns `true` if `prc` is a lambda, `false` if it is a proc. + * The difference is how they react to a `return` statement. In a lambda, + * `return` makes the lambda return. In a proc, `return` makes the method * that called the proc return. * * def gen_times(factor) @@ -71,7 +71,7 @@ mrb_proc_source_location(mrb_state *mrb, const struct RProc *p) * prc.source_location -> [filename, line] or nil * * Returns the Ruby source filename and line number containing this proc - * or +nil+ if this proc was not defined in Ruby (i.e. native). + * or `nil` if this proc was not defined in Ruby (i.e. native). * * p = proc { puts "hello" } * p.source_location #=> ["prog.rb", 1] @@ -134,7 +134,7 @@ proc_inspect(mrb_state *mrb, mrb_value self) * call-seq: * proc { |...| block } -> a_proc * - * Equivalent to Proc.new. + * Equivalent to `Proc.new`. * * def proc(&block) * block diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c index 2cba627e3..316906c70 100644 --- a/mrbgems/mruby-random/src/random.c +++ b/mrbgems/mruby-random/src/random.c @@ -419,13 +419,13 @@ mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) * ary.sample -> obj * ary.sample(n) -> new_ary * - * Choose a random element or +n+ random elements from the array. + * Choose a random element or `n` random elements from the array. * * The elements are chosen by using random and unique indices into the array * in order to ensure that an element doesn't repeat itself unless the array * already contained duplicate elements. * - * If the array is empty the first form returns +nil+ and the second form + * If the array is empty the first form returns `nil` and the second form * returns an empty array. */ diff --git a/mrbgems/mruby-range-ext/mrblib/range.rb b/mrbgems/mruby-range-ext/mrblib/range.rb index 10c0cde62..b79ed41fc 100644 --- a/mrbgems/mruby-range-ext/mrblib/range.rb +++ b/mrbgems/mruby-range-ext/mrblib/range.rb @@ -4,7 +4,7 @@ class Range # rng.first -> obj # rng.first(n) -> an_array # - # Returns the first object in the range, or an array of the first +n+ + # Returns the first object in the range, or an array of the first `n` # elements. # # (10..20).first #=> 10 @@ -33,10 +33,10 @@ class Range # rng.last(n) -> an_array # # Returns the last object in the range, - # or an array of the last +n+ elements. + # or an array of the last `n` elements. # - # Note that with no arguments +last+ will return the object that defines - # the end of the range even if #exclude_end? is +true+. + # Note that with no arguments `last` will return the object that defines + # the end of the range even if #exclude_end? is `true`. # # (10..20).last #=> 20 # (10...20).last #=> 20 diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c index e083503ba..f73ef23ed 100644 --- a/mrbgems/mruby-sprintf/src/sprintf.c +++ b/mrbgems/mruby-sprintf/src/sprintf.c @@ -856,7 +856,7 @@ retry: * format(format_string [, arguments...] ) -> string * sprintf(format_string [, arguments...] ) -> string * - * Returns the string resulting from applying format_string to + * Returns the string resulting from applying *format_string* to * any additional arguments. Within the format string, any characters * other than format sequences are copied to the result. * @@ -868,7 +868,7 @@ retry: * sequence consists of a percent sign, followed by optional flags, * width, and precision indicators, then terminated with a field type * character. The field type controls how the corresponding - * sprintf argument is to be interpreted, while the flags + * `sprintf` argument is to be interpreted, while the flags * modify that interpretation. * * The field type characters are: @@ -1043,7 +1043,7 @@ retry: * numeric fields, the precision controls the number of decimal places * displayed. For string fields, the precision determines the maximum * number of characters to be copied from the string. (Thus, the format - * sequence %10.10s will always contribute exactly ten + * sequence `%10.10s` will always contribute exactly ten * characters to the result.) * * Examples of precisions: diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb index b75944825..ff812f3dd 100644 --- a/mrbgems/mruby-string-ext/mrblib/string.rb +++ b/mrbgems/mruby-string-ext/mrblib/string.rb @@ -2,7 +2,7 @@ class String ## # Call the given block for each character of - # +self+. + # `self`. def each_char(&block) return to_enum :each_char unless block pos = 0 @@ -56,7 +56,7 @@ class String # a = "abc\ndef" # a.lines #=> ["abc\n", "def"] # - # If a block is given, it works the same as each_line. + # If a block is given, it works the same as `each_line`. def lines(&blk) lines = self.__lines if blk @@ -74,9 +74,9 @@ class String # str.upto(other_str, exclusive=false) {|s| block } -> str # str.upto(other_str, exclusive=false) -> an_enumerator # - # Iterates through successive values, starting at str and - # ending at other_str inclusive, passing each value in turn to - # the block. The String#succ method is used to generate + # Iterates through successive values, starting at *str* and + # ending at *other_str* inclusive, passing each value in turn to + # the block. The `String#succ` method is used to generate # each value. If optional second argument exclusive is omitted or is false, # the last value will be included; otherwise it will be excluded. # @@ -92,7 +92,7 @@ class String # a8 a9 b0 b1 b2 b3 b4 b5 b6 # a8 a9 b0 b1 b2 b3 b4 b5 b6 # - # If str and other_str contains only ascii numeric characters, + # If *str* and *other_str* contains only ascii numeric characters, # both are recognized as decimal numbers. In addition, the width of # string (e.g. leading zeros) is handled appropriately. # diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index 016cd920b..de12de131 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -89,8 +89,8 @@ int_chr_utf8(mrb_state *mrb, mrb_value num) * call-seq: * str.swapcase! -> str or nil * - * Equivalent to String#swapcase, but modifies the receiver in - * place, returning str, or nil if no changes were made. + * Equivalent to `String#swapcase`, but modifies the receiver in + * place, returning *str*, or `nil` if no changes were made. * Note: case conversion is effective only in ASCII region. */ static mrb_value @@ -122,7 +122,7 @@ str_swapcase_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.swapcase -> new_str * - * Returns a copy of str with uppercase alphabetic characters converted + * Returns a copy of *str* with uppercase alphabetic characters converted * to lowercase and lowercase characters converted to uppercase. * Note: case conversion is effective only in ASCII region. * @@ -184,7 +184,7 @@ str_concat0(mrb_state *mrb, mrb_value self, mrb_bool binary) * s.concat('bar', 'baz') # => "foobarbaz" * s # => "foobarbaz" * - * For each given object +object+ that is an \Integer, + * For each given object `object` that is an \Integer, * the value is considered a codepoint and converted to a character before concatenation: * * s = 'foo' @@ -215,7 +215,7 @@ str_append_as_bytes(mrb_state *mrb, mrb_value self) * call-seq: * str.start_with?([prefixes]+) -> true or false * - * Returns true if +str+ starts with one of the +prefixes+ given. + * Returns true if `str` starts with one of the `prefixes` given. * * "hello".start_with?("hell") #=> true * @@ -251,7 +251,7 @@ str_start_with(mrb_state *mrb, mrb_value self) * call-seq: * str.end_with?([suffixes]+) -> true or false * - * Returns true if +str+ ends with one of the +suffixes+ given. + * Returns true if `str` ends with one of the `suffixes` given. */ static mrb_value str_end_with(mrb_state *mrb, mrb_value self) @@ -873,9 +873,9 @@ str_chr(mrb_state *mrb, mrb_value self) * call-seq: * int.chr([encoding]) -> string * - * Returns a string containing the character represented by the +int+'s value - * according to +encoding+. +"ASCII-8BIT"+ (+"BINARY"+) and +"UTF-8"+ (only - * with +MRB_UTF8_STRING+) can be specified as +encoding+ (default is + * Returns a string containing the character represented by the `int`'s value + * according to `encoding`. +"ASCII-8BIT"+ (+"BINARY"+) and +"UTF-8"+ (only + * with `MRB_UTF8_STRING`) can be specified as `encoding` (default is * +"ASCII-8BIT"+). * * 65.chr #=> "A" @@ -1103,8 +1103,8 @@ str_codepoints(mrb_state *mrb, mrb_value self) * call-seq: * str.delete_prefix!(prefix) -> self or nil * - * Deletes leading prefix from str, returning - * nil if no change was made. + * Deletes leading `prefix` from *str*, returning + * `nil` if no change was made. * * "hello".delete_prefix!("hel") #=> "lo" * "hello".delete_prefix!("llo") #=> nil @@ -1137,7 +1137,7 @@ str_del_prefix_bang(mrb_state *mrb, mrb_value self) * call-seq: * str.delete_prefix(prefix) -> new_str * - * Returns a copy of str with leading prefix deleted. + * Returns a copy of *str* with leading `prefix` deleted. * * "hello".delete_prefix("hel") #=> "lo" * "hello".delete_prefix("llo") #=> "hello" @@ -1160,8 +1160,8 @@ str_del_prefix(mrb_state *mrb, mrb_value self) * call-seq: * str.delete_suffix!(suffix) -> self or nil * - * Deletes trailing suffix from str, returning - * nil if no change was made. + * Deletes trailing `suffix` from *str*, returning + * `nil` if no change was made. * * "hello".delete_suffix!("llo") #=> "he" * "hello".delete_suffix!("hel") #=> nil @@ -1192,7 +1192,7 @@ str_del_suffix_bang(mrb_state *mrb, mrb_value self) * call-seq: * str.delete_suffix(suffix) -> new_str * - * Returns a copy of str with leading suffix deleted. + * Returns a copy of *str* with leading `suffix` deleted. * * "hello".delete_suffix("hel") #=> "lo" * "hello".delete_suffix("llo") #=> "hello" @@ -1217,7 +1217,7 @@ str_del_suffix(mrb_state *mrb, mrb_value self) * call-seq: * str.casecmp(other_str) -> -1, 0, +1 or nil * - * Case-insensitive version of String#<=>. + * Case-insensitive version of `String#<=>`. * * "abcdef".casecmp("abcde") #=> 1 * "aBcDeF".casecmp("abcdef") #=> 0 @@ -1296,9 +1296,9 @@ str_lines(mrb_state *mrb, mrb_value self) * call-seq: * +string -> new_string or self * - * Returns +self+ if +self+ is not frozen. + * Returns `self` if `self` is not frozen. * - * Otherwise returns self.dup, which is not frozen. + * Otherwise returns `self.dup`, which is not frozen. */ static mrb_value str_uplus(mrb_state *mrb, mrb_value str) @@ -2014,11 +2014,11 @@ str_clear(mrb_state *mrb, mrb_value self) * call-seq: * str.partition(sep) -> [head, sep, tail] * - * Searches for the first occurrence of +sep+ in +str+. If +sep+ is found, - * returns a 3-element array containing the part of +str+ before +sep+, - * +sep+ itself, and the part of +str+ after +sep+. + * Searches for the first occurrence of `sep` in `str`. If `sep` is found, + * returns a 3-element array containing the part of `str` before `sep`, + * `sep` itself, and the part of `str` after `sep`. * - * If +sep+ is not found, returns a 3-element array containing +str+, + * If `sep` is not found, returns a 3-element array containing `str`, * an empty string, and an empty string. * * "hello world".partition(" ") #=> ["hello", " ", "world"] @@ -2075,12 +2075,12 @@ str_partition(mrb_state *mrb, mrb_value self) * call-seq: * str.rpartition(sep) -> [head, sep, tail] * - * Searches for the last occurrence of +sep+ in +str+. If +sep+ is found, - * returns a 3-element array containing the part of +str+ before +sep+, - * +sep+ itself, and the part of +str+ after +sep+. + * Searches for the last occurrence of `sep` in `str`. If `sep` is found, + * returns a 3-element array containing the part of `str` before `sep`, + * `sep` itself, and the part of `str` after `sep`. * - * If +sep+ is not found, returns a 3-element array containing an empty string, - * an empty string, and +str+. + * If `sep` is not found, returns a 3-element array containing an empty string, + * an empty string, and `str`. * * "hello world".rpartition(" ") #=> ["hello", " ", "world"] * "hello world".rpartition("o") #=> ["hello w", "o", "rld"] @@ -2136,11 +2136,11 @@ str_rpartition(mrb_state *mrb, mrb_value self) * call-seq: * str.insert(index, other_str) -> str * - * Inserts other_str before the character at the given - * index, modifying str. Negative indices count from the + * Inserts *other_str* before the character at the given + * *index*, modifying *str*. Negative indices count from the * end of the string, and insert after the given character. - * The intent is insert aString so that it starts at the given - * index. + * The intent is insert *aString* so that it starts at the given + * *index*. * * "abcd".insert(0, 'X') #=> "Xabcd" * "abcd".insert(3, 'X') #=> "abcXd" @@ -2183,7 +2183,7 @@ str_insert(mrb_state *mrb, mrb_value self) * call-seq: * str.prepend(*other_str) -> str * - * Prepend---Prepend the given strings to str. + * Prepend---Prepend the given strings to *str*. * * a = "world" * a.prepend("hello ") #=> "hello world" diff --git a/mrbgems/mruby-struct/mrblib/struct.rb b/mrbgems/mruby-struct/mrblib/struct.rb index 20d9bde86..7599be970 100644 --- a/mrbgems/mruby-struct/mrblib/struct.rb +++ b/mrbgems/mruby-struct/mrblib/struct.rb @@ -6,7 +6,7 @@ class Struct include Enumerable ## - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the respective element. # # ISO 15.2.18.4.4 @@ -18,7 +18,7 @@ class Struct end ## - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the name and value of the respective # element. # @@ -31,7 +31,7 @@ class Struct end ## - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and returns an array with all elements of which # block is not false. # @@ -54,9 +54,9 @@ class Struct # call-seq: # hsh.dig(key,...) -> object # - # Extracts the nested value specified by the sequence of key - # objects by calling +dig+ at each step, returning +nil+ if any - # intermediate step is +nil+. + # Extracts the nested value specified by the sequence of *key* + # objects by calling `dig` at each step, returning `nil` if any + # intermediate step is `nil`. # def dig(idx,*args) n = self[idx] diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index 6e541f59b..918a8abc4 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -224,23 +224,23 @@ make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass *kl * StructClass.new(arg, ...) -> obj * StructClass[arg, ...] -> obj * - * Creates a new class, named by aString, containing accessor - * methods for the given symbols. If the name aString is + * Creates a new class, named by *aString*, containing accessor + * methods for the given symbols. If the name *aString* is * omitted, an anonymous structure class will be created. Otherwise, * the name of this struct will appear as a constant in class - * Struct, so it must be unique for all - * Structs in the system and should start with a capital + * `Struct`, so it must be unique for all + * `Struct`s in the system and should start with a capital * letter. Assigning a structure class to a constant effectively gives * the class the name of the constant. * - * Struct::new returns a new Class object, + * `Struct::new` returns a new `Class` object, * which can then be used to create specific instances of the new * structure. The number of actual parameters must be * less than or equal to the number of attributes defined for this - * class; unset parameters default to nil. Passing too many - * parameters will raise an ArgumentError. + * class; unset parameters default to `nil`. Passing too many + * parameters will raise an `ArgumentError`. * - * If keyword_init is true, the struct will accept keyword + * If `keyword_init` is true, the struct will accept keyword * arguments for initialization instead of positional arguments: * * Person = Struct.new(:name, :age, keyword_init: true) @@ -486,9 +486,9 @@ struct_aref_int(mrb_state *mrb, mrb_value s, mrb_int i) * struct[fixnum] -> anObject * * Attribute Reference---Returns the value of the instance variable - * named by symbol, or indexed (0..length-1) by - * fixnum. Will raise NameError if the named - * variable does not exist, or IndexError if the index is + * named by *symbol*, or indexed (0..length-1) by + * *fixnum*. Will raise `NameError` if the named + * variable does not exist, or `IndexError` if the index is * out of range. * * Customer = Struct.new(:name, :address, :zip) @@ -536,9 +536,9 @@ mrb_struct_aset_sym(mrb_state *mrb, mrb_value s, mrb_sym id, mrb_value val) * struct[fixnum] = obj -> obj * * Attribute Assignment---Assigns to the instance variable named by - * symbol or fixnum the value obj and - * returns it. Will raise a NameError if the named - * variable does not exist, or an IndexError if the index + * *symbol* or *fixnum* the value *obj* and + * returns it. Will raise a `NameError` if the named + * variable does not exist, or an `IndexError` if the index * is out of range. * * Customer = Struct.new(:name, :address, :zip) @@ -577,10 +577,10 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s) * call-seq: * struct == other_struct -> true or false * - * Equality---Returns true if other_struct is + * Equality---Returns `true` if *other_struct* is * equal to this one: they must be of the same class as generated by - * Struct::new, and the values of all instance variables - * must be equal (according to Object#==). + * `Struct::new`, and the values of all instance variables + * must be equal (according to `Object#==`). * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) @@ -630,7 +630,7 @@ mrb_struct_equal(mrb_state *mrb, mrb_value s) * struct.eql?(other) -> true or false * * Two structures are equal if they are the same object, or if all their - * fields are equal (using eql?). + * fields are equal (using `eql?`). */ static mrb_value mrb_struct_eql(mrb_state *mrb, mrb_value s) @@ -762,19 +762,19 @@ mrb_struct_to_s(mrb_state *mrb, mrb_value self) } /* - * A Struct is a convenient way to bundle a number of + * A `Struct` is a convenient way to bundle a number of * attributes together, using accessor methods, without having to write * an explicit class. * - * The Struct class is a generator of specific classes, + * The `Struct` class is a generator of specific classes, * each one of which is defined to hold a set of variables and their * accessors. In these examples, we'll call the generated class - * "CustomerClass," and we'll show an example instance of that - * class as "CustomerInst." + * "*Customer*Class," and we'll show an example instance of that + * class as "*Customer*Inst." * - * In the descriptions that follow, the parameter symbol refers + * In the descriptions that follow, the parameter *symbol* refers * to a symbol, which is either a quoted string or a - * Symbol (such as :name). + * `Symbol` (such as `:name`). */ void mrb_mruby_struct_gem_init(mrb_state* mrb) diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb index 99fa275d5..c2166a9b9 100644 --- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb @@ -7,7 +7,7 @@ class Symbol # call-seq: # sym.capitalize -> symbol # - # Same as sym.to_s.capitalize.intern. + # Same as `sym.to_s.capitalize.intern`. def capitalize (self.to_s.capitalize! || self).to_sym @@ -17,7 +17,7 @@ class Symbol # call-seq: # sym.downcase -> symbol # - # Same as sym.to_s.downcase.intern. + # Same as `sym.to_s.downcase.intern`. def downcase (self.to_s.downcase! || self).to_sym @@ -27,7 +27,7 @@ class Symbol # call-seq: # sym.upcase -> symbol # - # Same as sym.to_s.upcase.intern. + # Same as `sym.to_s.upcase.intern`. def upcase (self.to_s.upcase! || self).to_sym @@ -37,7 +37,7 @@ class Symbol # call-seq: # sym.casecmp(other) -> -1, 0, +1 or nil # - # Case-insensitive version of Symbol#<=>. + # Case-insensitive version of `Symbol#<=>`. def casecmp(other) return nil unless other.kind_of?(Symbol) diff --git a/mrbgems/mruby-symbol-ext/src/symbol.c b/mrbgems/mruby-symbol-ext/src/symbol.c index 41aee9c7a..d0c481ad2 100644 --- a/mrbgems/mruby-symbol-ext/src/symbol.c +++ b/mrbgems/mruby-symbol-ext/src/symbol.c @@ -41,7 +41,7 @@ mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) * call-seq: * sym.length -> integer * - * Same as sym.to_s.length. + * Same as `sym.to_s.length`. */ static mrb_value mrb_sym_length(mrb_state *mrb, mrb_value self) diff --git a/mrblib/array.rb b/mrblib/array.rb index 5c1a9a89f..937b5d1be 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -8,7 +8,7 @@ class Array # array.each {|element| ... } -> self # array.each -> Enumerator # - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the respective element. # # ISO 15.2.12.5.10 @@ -28,7 +28,7 @@ class Array # array.each_index {|index| ... } -> self # array.each_index -> Enumerator # - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the index of the respective element. # # ISO 15.2.12.5.11 @@ -48,7 +48,7 @@ class Array # array.collect! {|element| ... } -> self # array.collect! -> new_enumerator # - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the respective element. Each element will # be replaced by the resulting values. # @@ -80,7 +80,7 @@ class Array # array.sort -> new_array # array.sort {|a, b| ... } -> new_array # - # Returns a new Array whose elements are those from +self+, sorted. + # Returns a new Array whose elements are those from `self`, sorted. def sort(&block) self.dup.sort!(&block) end diff --git a/mrblib/compar.rb b/mrblib/compar.rb index 2ac70ac6e..4ca0b6748 100644 --- a/mrblib/compar.rb +++ b/mrblib/compar.rb @@ -8,8 +8,8 @@ module Comparable # call-seq: # obj < other -> true or false # - # Return true if +self+ is less - # than +other+. Otherwise return + # Return true if `self` is less + # than `other`. Otherwise return # false. # # ISO 15.3.3.2.1 @@ -25,8 +25,8 @@ module Comparable # call-seq: # obj <= other -> true or false # - # Return true if +self+ is less - # than or equal to +other+. + # Return true if `self` is less + # than or equal to `other`. # Otherwise return false. # # ISO 15.3.3.2.2 @@ -42,8 +42,8 @@ module Comparable # call-seq: # obj == other -> true or false # - # Return true if +self+ is equal - # to +other+. Otherwise return + # Return true if `self` is equal + # to `other`. Otherwise return # false. # # ISO 15.3.3.2.3 @@ -56,8 +56,8 @@ module Comparable # call-seq: # obj > other -> true or false # - # Return true if +self+ is greater - # than +other+. Otherwise return + # Return true if `self` is greater + # than `other`. Otherwise return # false. # # ISO 15.3.3.2.4 @@ -73,8 +73,8 @@ module Comparable # call-seq: # obj >= other -> true or false # - # Return true if +self+ is greater - # than or equal to +other+. + # Return true if `self` is greater + # than or equal to `other`. # Otherwise return false. # # ISO 15.3.3.2.5 @@ -90,9 +90,9 @@ module Comparable # call-seq: # obj.between?(min,max) -> true or false # - # Return true if +self+ is greater - # than or equal to +min+ and - # less than or equal to +max+. + # Return true if `self` is greater + # than or equal to `min` and + # less than or equal to `max`. # Otherwise return false. # # ISO 15.3.3.2.6 diff --git a/mrblib/enum.rb b/mrblib/enum.rb index 23b275ae2..6496e559b 100644 --- a/mrblib/enum.rb +++ b/mrblib/enum.rb @@ -1,7 +1,7 @@ ## # Enumerable # -# The Enumerable mixin provides collection classes with +# The `Enumerable` mixin provides collection classes with # several traversal and searching methods, and with the ability to # sort. The class must provide a method `each`, which # yields successive members of the collection. If @@ -17,10 +17,10 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Return false + # which is yield by `each`. Return false # if one block value is false. Otherwise # return true. If no block is given and - # +self+ is false return false. + # `self` is false return false. # # ISO 15.3.2.2.1 def all?(&block) @@ -34,10 +34,10 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Return true + # which is yield by `each`. Return true # if one block value is true. Otherwise # return false. If no block is given and - # +self+ is true object return true. + # `self` is true object return true. # # ISO 15.3.2.2.2 def any?(&block) @@ -51,7 +51,7 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Append all + # which is yield by `each`. Append all # values of each block together and # return this value. # @@ -67,9 +67,9 @@ module Enumerable ## # Return the first element for which # value from the block is true. If no - # object matches, calls +ifnone+ and + # object matches, calls `ifnone` and # returns its result. Otherwise returns - # +nil+. + # `nil`. # # ISO 15.3.2.2.4 def detect(ifnone=nil, &block) @@ -85,7 +85,7 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Pass an + # which is yield by `each`. Pass an # index to the block which starts at 0 # and increase by 1 for each element. # @@ -103,7 +103,7 @@ module Enumerable ## # Return an array of all elements which - # are yield by +each+. + # are yield by `each`. # # ISO 15.3.2.2.6 def entries @@ -123,7 +123,7 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Return an array + # which is yield by `each`. Return an array # which contains all elements whose block # value was true. # @@ -140,9 +140,9 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+ and which return + # which is yield by `each` and which return # value was true when invoking === with - # +pattern+. Return an array with all + # `pattern`. Return an array with all # elements or the respective block values. # # ISO 15.3.2.2.9 @@ -159,8 +159,8 @@ module Enumerable ## # Return true if at least one element which - # is yield by +each+ returns a true value - # by invoking == with +obj+. Otherwise return + # is yield by `each` returns a true value + # by invoking == with `obj`. Otherwise return # false. # # ISO 15.3.2.2.10 @@ -173,7 +173,7 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Return value + # which is yield by `each`. Return value # is the sum of all block values. Pass # to each block the current sum and the # current element. @@ -215,7 +215,7 @@ module Enumerable ## # Return the maximum value of all elements - # yield by +each+. If no block is given <=> + # yield by `each`. If no block is given <=> # will be invoked to define this value. If # a block is given it will be used instead. # @@ -242,7 +242,7 @@ module Enumerable ## # Return the minimum value of all elements - # yield by +each+. If no block is given <=> + # yield by `each`. If no block is given <=> # will be invoked to define this value. If # a block is given it will be used instead. # @@ -275,7 +275,7 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Return an + # which is yield by `each`. Return an # array which contains two arrays. The # first array contains all elements # whose block value was true. The second @@ -300,7 +300,7 @@ module Enumerable ## # Call the given block for each element - # which is yield by +each+. Return an + # which is yield by `each`. Return an # array which contains only the elements # whose block value was false. # @@ -323,7 +323,7 @@ module Enumerable ## # Return a sorted array of all elements - # which are yield by +each+. If no block + # which are yield by `each`. If no block # is given <=> will be invoked on each # element to define the order. Otherwise # the given block will be used for diff --git a/mrblib/hash.rb b/mrblib/hash.rb index 897523c14..bee4abf23 100644 --- a/mrblib/hash.rb +++ b/mrblib/hash.rb @@ -16,8 +16,8 @@ class Hash # hash.delete(key) -> value or nil # hash.delete(key) {|key| ... } -> object # - # Delete the element with the key +key+. - # Return the value of the element if +key+ + # Delete the element with the key `key`. + # Return the value of the element if `key` # was found. Return nil if nothing was # found. If a block is given, call the # block with the value of the element. @@ -37,7 +37,7 @@ class Hash # hsh.each -> an_enumerator # hsh.each_pair -> an_enumerator # - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the key and value of each element. # # If no block is given, an enumerator is returned instead. @@ -70,7 +70,7 @@ class Hash # hsh.each_key {| key | block } -> hsh # hsh.each_key -> an_enumerator # - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the key of each element. # # If no block is given, an enumerator is returned instead. @@ -96,7 +96,7 @@ class Hash # hsh.each_value {| value | block } -> self # hsh.each_value -> an_enumerator # - # Calls the given block with each value; returns +self+: + # Calls the given block with each value; returns `self`: # # If no block is given, an enumerator is returned instead. # @@ -121,10 +121,10 @@ class Hash # hsh.merge(other_hash..) -> hsh # hsh.merge(other_hash..){|key, oldval, newval| block} -> hsh # - # Returns the new \Hash formed by merging each of +other_hashes+ - # into a copy of +self+. + # Returns the new \Hash formed by merging each of `other_hashes` + # into a copy of `self`. # - # Each argument in +other_hashes+ must be a \Hash. + # Each argument in `other_hashes` must be a \Hash. # Adds the contents of _other_hash_ to _hsh_. If no block is specified, # entries with duplicate keys are overwritten with the values from # _other_hash_, otherwise the value of each duplicate key is determined by @@ -159,8 +159,8 @@ class Hash # hsh.reject! {| key, value | block } -> hsh or nil # hsh.reject! -> an_enumerator # - # Equivalent to Hash#delete_if, but returns - # nil if no changes were made. + # Equivalent to `Hash#delete_if`, but returns + # `nil` if no changes were made. # # 1.8/1.9 Hash#reject! returns Hash; ISO says nothing. # @@ -212,8 +212,8 @@ class Hash # hsh.select! {| key, value | block } -> hsh or nil # hsh.select! -> an_enumerator # - # Equivalent to Hash#keep_if, but returns - # nil if no changes were made. + # Equivalent to `Hash#keep_if`, but returns + # `nil` if no changes were made. # # 1.9 Hash#select! returns Hash; ISO says nothing. # diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb index 0d8dff8a0..004af69b9 100644 --- a/mrblib/numeric.rb +++ b/mrblib/numeric.rb @@ -41,7 +41,7 @@ end class Integer ## # Calls the given block once for each Integer - # from +self+ downto +num+. + # from `self` downto `num`. # # ISO 15.2.8.3.15 def downto(num, &block) @@ -66,7 +66,7 @@ class Integer alias succ next ## - # Calls the given block +self+ times. + # Calls the given block `self` times. # # ISO 15.2.8.3.22 def times(&block) @@ -82,7 +82,7 @@ class Integer ## # Calls the given block once for each Integer - # from +self+ upto +num+. + # from `self` upto `num`. # # ISO 15.2.8.3.27 def upto(num, &block) @@ -97,8 +97,8 @@ class Integer end ## - # Calls the given block from +self+ to +num+ - # incremented by +step+ (default 1). + # Calls the given block from `self` to `num` + # incremented by `step` (default 1). # def step(num=nil, step=1, &block) raise ArgumentError, "step can't be 0" if step == 0 @@ -129,8 +129,8 @@ end class Float ## - # Calls the given block from +self+ to +num+ - # incremented by +step+ (default 1). + # Calls the given block from `self` to `num` + # incremented by `step` (default 1). # def step(num=nil, step=1, &block) raise ArgumentError, "step can't be 0" if step == 0 diff --git a/mrblib/range.rb b/mrblib/range.rb index 4a8e10f30..0fb0e8cbd 100644 --- a/mrblib/range.rb +++ b/mrblib/range.rb @@ -10,7 +10,7 @@ class Range include Enumerable ## - # Calls the given block for each element of +self+ + # Calls the given block for each element of `self` # and pass the respective element. # # ISO 15.2.14.4.4 diff --git a/mrblib/string.rb b/mrblib/string.rb index 51be9b7dd..dfbbbd255 100644 --- a/mrblib/string.rb +++ b/mrblib/string.rb @@ -43,9 +43,9 @@ class String end ## - # Replace all matches of +pattern+ with +replacement+. + # Replace all matches of `pattern` with `replacement`. # Call block (if given) for each match and replace - # +pattern+ with the value of the block. Return the + # `pattern` with the value of the block. Return the # final value. # # ISO 15.2.10.5.18 @@ -78,10 +78,10 @@ class String end ## - # Replace all matches of +pattern+ with +replacement+. + # Replace all matches of `pattern` with `replacement`. # Call block (if given) for each match and replace - # +pattern+ with the value of the block. Modify - # +self+ with the final value. + # `pattern` with the value of the block. Modify + # `self` with the final value. # # ISO 15.2.10.5.19 def gsub!(*args, &block) @@ -93,9 +93,9 @@ class String end # ## -# # Calls the given block for each match of +pattern+ +# # Calls the given block for each match of `pattern` # # If no block is given return an array with all -# # matches of +pattern+. +# # matches of `pattern`. # # # # ISO 15.2.10.5.32 # def scan(pattern, &block) @@ -103,9 +103,9 @@ class String # end ## - # Replace only the first match of +pattern+ with - # +replacement+. Call block (if given) for each - # match and replace +pattern+ with the value of the + # Replace only the first match of `pattern` with + # `replacement`. Call block (if given) for each + # match and replace `pattern` with the value of the # block. Return the final value. # # ISO 15.2.10.5.36 @@ -133,10 +133,10 @@ class String end ## - # Replace only the first match of +pattern+ with - # +replacement+. Call block (if given) for each - # match and replace +pattern+ with the value of the - # block. Modify +self+ with the final value. + # Replace only the first match of `pattern` with + # `replacement`. Call block (if given) for each + # match and replace `pattern` with the value of the + # block. Modify `self` with the final value. # # ISO 15.2.10.5.37 def sub!(*args, &block) @@ -147,7 +147,7 @@ class String end ## - # Call the given block for each byte of +self+. + # Call the given block for each byte of `self`. def each_byte(&block) return to_enum(:each_byte, &block) unless block pos = 0 diff --git a/src/array.c b/src/array.c index 5c308970c..fd043786a 100644 --- a/src/array.c +++ b/src/array.c @@ -496,7 +496,7 @@ mrb_ary_concat(mrb_state *mrb, mrb_value self, mrb_value other) * call-seq: * array.concat(*other_arrays) -> self * - * Adds to +array+ all elements from each \Array in +other_arrays+; returns +self+: + * Adds to `array` all elements from each \Array in `other_arrays`; returns `self`: * * a = [0, 1] * a.concat([2, 3], [4, 5]) # => [0, 1, 2, 3, 4, 5] @@ -990,7 +990,7 @@ mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item) * call-seq: * array.unshift(*objects) -> self * - * Prepends the given +objects+ to +self+: + * Prepends the given `objects` to `self`: * * a = [:foo, 'bar', 2] * a.unshift(:bam, :bat) # => [:bam, :bat, :foo, "bar", 2] @@ -1283,16 +1283,16 @@ aget_index(mrb_state *mrb, mrb_value index) * ary.slice(start, length) -> new_ary or nil * ary.slice(range) -> new_ary or nil * - * Element Reference --- Returns the element at +index+, or returns a - * subarray starting at the +start+ index and continuing for +length+ - * elements, or returns a subarray specified by +range+ of indices. + * Element Reference --- Returns the element at `index`, or returns a + * subarray starting at the `start` index and continuing for `length` + * elements, or returns a subarray specified by `range` of indices. * * Negative indices count backward from the end of the array (-1 is the last - * element). For +start+ and +range+ cases the starting index is just before + * element). For `start` and `range` cases the starting index is just before * an element. Additionally, an empty array is returned when the starting * index for an element range is at the end of the array. * - * Returns +nil+ if the index (or starting index) are out of range. + * Returns `nil` if the index (or starting index) are out of range. * * a = [ "a", "b", "c", "d", "e" ] * a[1] => "b" @@ -1344,16 +1344,16 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self) * ary[start, length] = obj or other_ary or nil -> obj or other_ary or nil * ary[range] = obj or other_ary or nil -> obj or other_ary or nil * - * Element Assignment --- Sets the element at +index+, or replaces a subarray - * from the +start+ index for +length+ elements, or replaces a subarray - * specified by the +range+ of indices. + * Element Assignment --- Sets the element at `index`, or replaces a subarray + * from the `start` index for `length` elements, or replaces a subarray + * specified by the `range` of indices. * * If indices are greater than the current capacity of the array, the array - * grows automatically. Elements are inserted into the array at +start+ if - * +length+ is zero. + * grows automatically. Elements are inserted into the array at `start` if + * `length` is zero. * * Negative indices will count backward from the end of the array. For - * +start+ and +range+ cases the starting index is just before an element. + * `start` and `range` cases the starting index is just before an element. * * An IndexError is raised if a negative index points past the beginning of * the array. @@ -1524,11 +1524,11 @@ mrb_ary_last(mrb_state *mrb, mrb_value self) * ary.index {|item| block } -> int or nil * array.index -> enumerator * - * Returns the _index_ of the first object in +ary+ such that the object is - * == to +obj+. + * Returns the _index_ of the first object in `ary` such that the object is + * `==` to `obj`. * * If a block is given instead of an argument, returns the _index_ of the - * first object for which the block returns +true+. Returns +nil+ if no + * first object for which the block returns `true`. Returns `nil` if no * match is found. * * ISO 15.2.12.5.14 @@ -1566,11 +1566,11 @@ mrb_ary_index_m(mrb_state *mrb, mrb_value self) * ary.rindex {|item| block } -> int or nil * array.rindex -> enumerator * - * Returns the _index_ of the first object in +ary+ such that the object is - * == to +obj+. + * Returns the _index_ of the first object in `ary` such that the object is + * `==` to `obj`. * * If a block is given instead of an argument, returns the _index_ of the - * first object for which the block returns +true+. Returns +nil+ if no + * first object for which the block returns `true`. Returns `nil` if no * match is found. * * ISO 15.2.12.5.26 @@ -1818,7 +1818,7 @@ mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep) * ary.join(sep="") -> str * * Returns a string created by converting each element of the array to - * a string, separated by sep. + * a string, separated by *sep*. * * [ "a", "b", "c" ].join #=> "abc" * [ "a", "b", "c" ].join("-") #=> "a-b-c" @@ -1907,7 +1907,7 @@ mrb_ary_eq(mrb_state *mrb, mrb_value ary1) * call-seq: * array.eql? other_array -> true or false * - * Returns true if +self+ and _other_ are the same object, + * Returns `true` if `self` and _other_ are the same object, * or are both arrays with the same content. * */ @@ -1939,12 +1939,12 @@ mrb_ary_eql(mrb_state *mrb, mrb_value ary1) * array <=> other_array -> -1, 0, or 1 * * Comparison---Returns an integer (-1, 0, or +1) - * if this array is less than, equal to, or greater than other_ary. + * if this array is less than, equal to, or greater than *other_ary*. * Each object in each array is compared (using <=>). If any value isn't * equal, then that inequality is the return value. If all the * values found are equal, then the return is based on a * comparison of the array lengths. Thus, two arrays are - * "equal" according to Array*<=> if and only if they have + * "equal" according to `Array#<=>` if and only if they have * the same length and the value of each element is equal to the * value of the corresponding element in the other array. */ @@ -2149,7 +2149,7 @@ insertion_sort(mrb_state *mrb, mrb_value ary, mrb_value *a, mrb_int size, mrb_va * array.sort! -> self * array.sort! {|a, b| ... } -> self * - * Sort all elements and replace +self+ with these + * Sort all elements and replace `self` with these * elements. */ static mrb_value diff --git a/src/class.c b/src/class.c index 7cc5d1153..57389b1b0 100644 --- a/src/class.c +++ b/src/class.c @@ -245,16 +245,7 @@ create_method_value(mrb_state *mrb, mrb_sym key, union mt_ptr val) return m; } -/* - * Iterates over the methods in a class's method table. - * - * @param mrb The mruby state. - * @param c The class whose method table is to be iterated. - * @param fn The callback function to be called for each method. - * The function receives the mruby state, the method symbol, the method itself, and user data. - * It should return 0 to continue iteration, or a non-zero value to stop. - * @param p User data to be passed to the callback function. - */ +/* Iterates over methods in a class's method table with callback function */ MRB_API void mrb_mt_foreach(mrb_state *mrb, struct RClass *c, mrb_mt_foreach_func *fn, void *p) { @@ -2176,8 +2167,8 @@ mrb_obj_extend(mrb_state *mrb, mrb_value obj) * call-seq: * mod.include?(module) -> true or false * - * Returns true if module is included in - * mod or one of mod's ancestors. + * Returns `true` if *module* is included in + * *mod* or one of *mod*'s ancestors. * * module A * end @@ -2831,9 +2822,9 @@ mrb_instance_alloc(mrb_state *mrb, mrb_value cv) * call-seq: * class.new(args, ...) -> obj * - * Creates a new object of class's class, then - * invokes that object's initialize method, - * passing it args. This is the method that ends + * Creates a new object of *class*'s class, then + * invokes that object's `initialize` method, + * passing it *args*. This is the method that ends * up getting called whenever an object is constructed using * `.new`. * @@ -2961,24 +2952,24 @@ mrb_bob_not(mrb_state *mrb, mrb_value cv) * obj.equal?(other) -> true or false * obj.eql?(other) -> true or false * - * Equality---At the Object level, == returns - * true only if obj and other are the + * Equality---At the `Object` level, `==` returns + * `true` only if *obj* and *other* are the * same object. Typically, this method is overridden in descendant * classes to provide class-specific meaning. * - * Unlike ==, the equal? method should never be + * Unlike `==`, the `equal?` method should never be * overridden by subclasses: it is used to determine object identity - * (that is, a.equal?(b) iff a is the same - * object as b). + * (that is, `a.equal?(b)` iff `a` is the same + * object as `b`). * - * The eql? method returns true if - * obj and anObject have the same value. Used by - * Hash to test members for equality. For objects of - * class Object, eql? is synonymous with - * ==. Subclasses normally continue this tradition, but - * there are exceptions. Numeric types, for example, - * perform type conversion across ==, but not across - * eql?, so: + * The `eql?` method returns `true` if + * *obj* and *anObject* have the same value. Used by + * `Hash` to test members for equality. For objects of + * class `Object`, `eql?` is synonymous with + * `==`. Subclasses normally continue this tradition, but + * there are exceptions. `Numeric` types, for example, + * perform type conversion across `==`, but not across + * `eql?`, so: * * 1 == 1.0 #=> true * 1.eql? 1.0 #=> false @@ -3242,10 +3233,10 @@ mrb_module_new(mrb_state *mrb) * call-seq: * obj.class => class * - * Returns the class of obj, now preferred over - * Object#type, as an object's type in Ruby is only + * Returns the class of *obj*, now preferred over + * `Object#type`, as an object's type in Ruby is only * loosely tied to that object's class. This method must always be - * called with an explicit receiver, as class is also a + * called with an explicit receiver, as `class` is also a * reserved word in Ruby. * * 1.class #=> Integer @@ -3718,7 +3709,7 @@ mrb_mod_const_missing(mrb_state *mrb, mrb_value mod) * call-seq: * mod.method_defined?(symbol) -> true or false * - * Returns +true+ if the named method is defined by + * Returns `true` if the named method is defined by * _mod_ (or its included modules and, if _mod_ is a class, * its ancestors). Public and protected methods are matched. * @@ -4003,10 +3994,10 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj) * call-seq: * obj.clone -> an_object * - * Produces a shallow copy of obj---the instance variables of - * obj are copied, but not the objects they reference. Copies - * the frozen state of obj. See also the discussion - * under Object#dup. + * Produces a shallow copy of *obj*---the instance variables of + * *obj* are copied, but not the objects they reference. Copies + * the frozen state of *obj*. See also the discussion + * under `Object#dup`. * * class Klass * attr_accessor :str @@ -4019,7 +4010,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj) * s2.inspect #=> "#" * * This method may have class-specific behavior. If so, that - * behavior will be documented under the #+initialize_copy+ method of + * behavior will be documented under the #`initialize_copy` method of * the class. * * Some Class(True False Nil Symbol Integer Float) Object cannot clone. @@ -4075,17 +4066,17 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self) * call-seq: * obj.dup -> an_object * - * Produces a shallow copy of obj---the instance variables of - * obj are copied, but not the objects they reference. - * dup copies the frozen state of obj. See also - * the discussion under Object#clone. In general, - * clone and dup may have different semantics - * in descendant classes. While clone is used to duplicate - * an object, including its internal state, dup typically + * Produces a shallow copy of *obj*---the instance variables of + * *obj* are copied, but not the objects they reference. + * `dup` copies the frozen state of *obj*. See also + * the discussion under `Object#clone`. In general, + * `clone` and `dup` may have different semantics + * in descendant classes. While `clone` is used to duplicate + * an object, including its internal state, `dup` typically * uses the class of the descendant object to create the new instance. * * This method may have class-specific behavior. If so, that - * behavior will be documented under the #+initialize_copy+ method of + * behavior will be documented under the #`initialize_copy` method of * the class. */ @@ -4144,16 +4135,16 @@ mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args) * call-seq: * obj.method_missing(symbol [, *args] ) -> result * - * Invoked by Ruby when obj is sent a message it cannot handle. - * symbol is the symbol for the method called, and args + * Invoked by Ruby when *obj* is sent a message it cannot handle. + * *symbol* is the symbol for the method called, and *args* * are any arguments that were passed to it. By default, the interpreter * raises an error when this method is called. However, it is possible * to override the method to provide more dynamic behavior. * If it is decided that a particular method should not be handled, then - * super should be called, so that ancestors can pick up the + * *super* should be called, so that ancestors can pick up the * missing method. * The example below creates - * a class Roman, which responds to methods with names + * a class `Roman`, which responds to methods with names * consisting of roman numerals, returning the corresponding integer * values. * diff --git a/src/error.c b/src/error.c index 0007daf36..4b39381dd 100644 --- a/src/error.c +++ b/src/error.c @@ -80,7 +80,7 @@ exc_initialize(mrb_state *mrb, mrb_value exc) * With no argument, or if the argument is the same as the receiver, * return the receiver. Otherwise, create a new * exception object of the same class as the receiver, but with a - * message equal to string. + * message equal to `string`. * */ diff --git a/src/gc.c b/src/gc.c index 0be46af7c..f51d0bc1e 100644 --- a/src/gc.c +++ b/src/gc.c @@ -1335,7 +1335,7 @@ gc_start(mrb_state *mrb, mrb_value obj) * call-seq: * GC.enable -> true or false * - * Enables garbage collection, returning true if garbage + * Enables garbage collection, returning `true` if garbage * collection was previously disabled. * * GC.disable #=> false @@ -1358,7 +1358,7 @@ gc_enable(mrb_state *mrb, mrb_value obj) * call-seq: * GC.disable -> true or false * - * Disables garbage collection, returning true if garbage + * Disables garbage collection, returning `true` if garbage * collection was already disabled. * * GC.disable #=> false diff --git a/src/hash.c b/src/hash.c index b8ac9fd48..2a27a7ffb 100644 --- a/src/hash.c +++ b/src/hash.c @@ -1417,10 +1417,10 @@ hash_set_default_proc(mrb_state *mrb, mrb_value hash, mrb_value proc) * * Returns a new, empty hash. If this hash is subsequently accessed by * a key that doesn't correspond to a hash entry, the value returned - * depends on the style of new used to create the hash. In - * the first form, the access returns nil. If - * obj is specified, this single object will be used for - * all default values. If a block is specified, it will be + * depends on the style of `new` used to create the hash. In + * the first form, the access returns `nil`. If + * `obj` is specified, this single object will be used for + * all default values. If a block is specified, it will be * called with the hash object and the key, and should return the * default value. It is the block's responsibility to store the value * in the hash if required. @@ -1472,9 +1472,9 @@ mrb_hash_init(mrb_state *mrb, mrb_value hash) * call-seq: * hsh[key] -> value * - * Element Reference---Retrieves the value object corresponding - * to the key object. If not found, returns the default value (see - * Hash::new for details). + * Element Reference---Retrieves the `value` object corresponding + * to the `key` object. If not found, returns the default value (see + * `Hash::new` for details). * * h = { "a" => 100, "b" => 200 } * h["a"] #=> 100 @@ -1495,8 +1495,8 @@ mrb_hash_aget(mrb_state *mrb, mrb_value self) * hsh.default(key=nil) -> obj * * Returns the default value, the value that would be returned by - * hsh[key] if key did not exist in hsh. - * See also Hash::new and Hash#default=. + * `hsh`[`key`] if `key` did not exist in `hsh`. + * See also `Hash::new` and `Hash#default=`. * * h = Hash.new #=> {} * h.default #=> nil @@ -1537,7 +1537,7 @@ mrb_hash_default(mrb_state *mrb, mrb_value hash) * * Sets the default value, the value returned for a key that does not * exist in the hash. It is not possible to set the default to a - * Proc that will be executed on each key lookup. + * `Proc` that will be executed on each key lookup. * * h = { "a" => 100, "b" => 200 } * h.default = "Go fish" @@ -1573,8 +1573,8 @@ mrb_hash_set_default(mrb_state *mrb, mrb_value hash) * call-seq: * hsh.default_proc -> anObject * - * If Hash::new was invoked with a block, return that - * block, otherwise return nil. + * If `Hash::new` was invoked with a block, return that + * block, otherwise return `nil`. * * h = Hash.new {|h,k| h[k] = k*k } #=> {} * p = h.default_proc #=> # @@ -1664,8 +1664,8 @@ mrb_hash_delete(mrb_state *mrb, mrb_value self) * call-seq: * hsh.shift -> anArray or obj * - * Removes a key-value pair from hsh and returns it as the - * two-item array [ key, value ], or + * Removes a key-value pair from `hsh` and returns it as the + * two-item array [ `key`, `value` ], or * the hash's default value if the hash is empty. * * h = { 1 => "a", 2 => "b", 3 => "c" } @@ -1719,9 +1719,9 @@ mrb_hash_clear(mrb_state *mrb, mrb_value hash) * hsh.store(key, value) -> value * * Element Assignment---Associates the value given by - * value with the key given by key. - * key should not have its value changed while it is in - * use as a key (a String passed as a key will be + * `value` with the key given by `key`. + * `key` should not have its value changed while it is in + * use as a key (a `String` passed as a key will be * duplicated and frozen). * * h = { "a" => 100, "b" => 200 } @@ -1792,7 +1792,7 @@ mrb_hash_empty_p(mrb_state *mrb, mrb_value self) * call-seq: * hsh.empty? -> true or false * - * Returns true if hsh contains no key-value pairs. + * Returns `true` if `hsh` contains no key-value pairs. * * {}.empty? #=> true * @@ -1809,7 +1809,7 @@ mrb_hash_empty_m(mrb_state *mrb, mrb_value self) * hsh.keys -> array * * Returns a new array populated with the keys from this hash. See also - * Hash#values. + * `Hash#values`. * * h = { "a" => 100, "b" => 200, "c" => 300, "d" => 400 } * h.keys #=> ["a", "b", "c", "d"] @@ -1832,8 +1832,8 @@ mrb_hash_keys(mrb_state *mrb, mrb_value hash) * call-seq: * hsh.values -> array * - * Returns a new array populated with the values from hsh. See - * also Hash#keys. + * Returns a new array populated with the values from `hsh`. See + * also `Hash#keys`. * * h = { "a" => 100, "b" => 200, "c" => 300 } * h.values #=> [100, 200, 300] @@ -1862,7 +1862,7 @@ mrb_hash_values(mrb_state *mrb, mrb_value hash) * hsh.key?(key) -> true or false * hsh.member?(key) -> true or false * - * Returns true if the given key is present in hsh. + * Returns `true` if the given key is present in `hsh`. * * h = { "a" => 100, "b" => 200 } * h.has_key?("a") #=> true @@ -1894,8 +1894,8 @@ mrb_hash_has_key(mrb_state *mrb, mrb_value hash) * hsh.has_value?(value) -> true or false * hsh.value?(value) -> true or false * - * Returns true if the given value is present for some key - * in hsh. + * Returns `true` if the given value is present for some key + * in `hsh`. * * h = { "a" => 100, "b" => 200 } * h.has_value?(100) #=> true @@ -1971,7 +1971,7 @@ mrb_hash_merge_m(mrb_state *mrb, mrb_value hash) * * Rebuilds the hash based on the current hash values for each key. If * values of key objects have changed since they were inserted, this - * method will reindex hsh. + * method will reindex `hsh`. * * keys = (1..17).map{|n| [n]} * k = keys[0] diff --git a/src/kernel.c b/src/kernel.c index 1886013a3..16b583dcc 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -92,9 +92,9 @@ inspect_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p) * obj.inspect -> string * * Returns a string containing a human-readable representation of - * obj. If not overridden and no instance variables, uses the - * to_s method to generate the string. - * obj. If not overridden, uses the to_s method to + * *obj*. If not overridden and no instance variables, uses the + * `to_s` method to generate the string. + * *obj*. If not overridden, uses the `to_s` method to * generate the string. * * [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" @@ -120,9 +120,9 @@ mrb_obj_inspect(mrb_state *mrb, mrb_value obj) * call-seq: * obj === other -> true or false * - * Case Equality---For class Object, effectively the same - * as calling #==, but typically overridden by descendants - * to provide meaningful semantics in case statements. + * Case Equality---For class `Object`, effectively the same + * as calling `#==`, but typically overridden by descendants + * to provide meaningful semantics in `case` statements. */ static mrb_value mrb_eqq_m(mrb_state *mrb, mrb_value self) @@ -208,12 +208,12 @@ mrb_obj_method_recursive_p(mrb_state *mrb, mrb_value obj) * obj.__id__ -> int * obj.object_id -> int * - * Returns an integer identifier for obj. The same number will - * be returned on all calls to id for a given object, and + * Returns an integer identifier for *obj*. The same number will + * be returned on all calls to `id` for a given object, and * no two active objects will share an id. - * Object#object_id is a different concept from the - * :name notation, which returns the symbol id of - * name. Replaces the deprecated Object#id. + * `Object#object_id` is a different concept from the + * `:name` notation, which returns the symbol id of + * `name`. Replaces the deprecated `Object#id`. */ mrb_value mrb_obj_id_m(mrb_state *mrb, mrb_value self) @@ -242,8 +242,8 @@ env_bidx(struct REnv *e) * block_given? -> true or false * iterator? -> true or false * - * Returns true if yield would execute a - * block in the current context. The iterator? form + * Returns `true` if `yield` would execute a + * block in the current context. The `iterator?` form * is mildly deprecated. * * def try @@ -323,8 +323,8 @@ mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self) * call-seq: * obj.class -> class * - * Returns the class of obj. This method must always be - * called with an explicit receiver, as class is also a + * Returns the class of *obj*. This method must always be + * called with an explicit receiver, as `class` is also a * reserved word in Ruby. * * 1.class #=> Integer @@ -364,11 +364,11 @@ mrb_obj_frozen(mrb_state *mrb, mrb_value self) * call-seq: * obj.hash -> int * - * Generates a Integer hash value for this object. This - * function must have the property that a.eql?(b) implies - * a.hash == b.hash. The hash value is used by class - * Hash. Any hash value that exceeds the capacity of a - * Integer will be truncated before being used. + * Generates a `Integer` hash value for this object. This + * function must have the property that `a.eql?(b)` implies + * `a.hash == b.hash`. The hash value is used by class + * `Hash`. Any hash value that exceeds the capacity of a + * `Integer` will be truncated before being used. */ static mrb_value mrb_obj_hash(mrb_state *mrb, mrb_value self) @@ -409,8 +409,8 @@ mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, const struct RClass* c) * call-seq: * obj.instance_of?(class) -> true or false * - * Returns true if obj is an instance of the given - * class. See also Object#kind_of?. + * Returns `true` if *obj* is an instance of the given + * class. See also `Object#kind_of?`. */ static mrb_value obj_is_instance_of(mrb_state *mrb, mrb_value self) @@ -429,9 +429,9 @@ obj_is_instance_of(mrb_state *mrb, mrb_value self) * obj.is_a?(class) -> true or false * obj.kind_of?(class) -> true or false * - * Returns true if class is the class of - * obj, or if class is one of the superclasses of - * obj or modules included in obj. + * Returns `true` if *class* is the class of + * *obj*, or if *class* is one of the superclasses of + * *obj* or modules included in *obj*. * * module M; end * class A @@ -465,7 +465,7 @@ mrb_obj_is_kind_of_m(mrb_state *mrb, mrb_value self) * nil.nil? -> true * .nil? -> false * - * Only the object nil responds true to nil?. + * Only the object *nil* responds `true` to `nil?`. */ static mrb_value mrb_false(mrb_state *mrb, mrb_value self) @@ -481,15 +481,15 @@ mrb_false(mrb_state *mrb, mrb_value self) * raise(string) * raise(exception [, string]) * - * With no arguments, raises a RuntimeError - * With a single +String+ argument, raises a - * +RuntimeError+ with the string as a message. Otherwise, - * the first parameter should be the name of an +Exception+ - * class (or an object that returns an +Exception+ object when sent - * an +exception+ message). The optional second parameter sets the + * With no arguments, raises a `RuntimeError` + * With a single `String` argument, raises a + * `RuntimeError` with the string as a message. Otherwise, + * the first parameter should be the name of an `Exception` + * class (or an object that returns an `Exception` object when sent + * an `exception` message). The optional second parameter sets the * message associated with the exception, and the third parameter is an * array of callback information. Exceptions are caught by the - * +rescue+ clause of begin...end blocks. + * `rescue` clause of `begin...end` blocks. * * raise "Failed to create socket" * raise ArgumentError, "No parameters", caller @@ -528,7 +528,7 @@ mrb_f_raise(mrb_state *mrb, mrb_value self) * call-seq: * obj.remove_instance_variable(symbol) -> obj * - * Removes the named instance variable from obj, returning that + * Removes the named instance variable from *obj*, returning that * variable's value. * * class Dummy @@ -565,15 +565,15 @@ mrb_obj_remove_instance_variable(mrb_state *mrb, mrb_value self) * call-seq: * obj.respond_to?(symbol, include_private=false) -> true or false * - * Returns +true+ if _obj_ responds to the given + * Returns `true` if _obj_ responds to the given * method. Private methods are included in the search only if the - * optional second parameter evaluates to +true+. + * optional second parameter evaluates to `true`. * * If the method is not implemented, * as Process.fork on Windows, File.lchmod on GNU/Linux, etc., * false is returned. * - * If the method is not defined, respond_to_missing? + * If the method is not defined, `respond_to_missing?` * method is called and the result is returned. */ static mrb_value diff --git a/src/numeric.c b/src/numeric.c index 71ffa74c6..21b20cd6e 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -133,7 +133,7 @@ mrb_int_pow(mrb_state *mrb, mrb_value x, mrb_value y) * * num ** other -> num * - * Raises num the other power. + * Raises `num` the `other` power. * * 2.0**3 #=> 8.0 */ @@ -198,7 +198,7 @@ mrb_div_int_value(mrb_state *mrb, mrb_int x, mrb_int y) * int / num -> num * * Performs division: the class of the resulting object depends on - * the class of num and on the magnitude of the + * the class of `num` and on the magnitude of the * result. */ static mrb_value @@ -333,7 +333,7 @@ coerce_step_counter(mrb_state *mrb, mrb_value self) * * Document-class: Float * - * Float objects represent inexact real numbers using + * `Float` objects represent inexact real numbers using * the native architecture's double-precision floating-point * representation. */ @@ -448,8 +448,8 @@ mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt) * * Returns a string containing a representation of self. As well as a * fixed or exponential form of the number, the call may return - * "NaN", "Infinity", and - * "-Infinity". + * "`NaN`", "`Infinity`", and + * "`-Infinity`". * * 3.0.to_s #=> 3.0 * 3.25.to_s #=> 3.25 @@ -481,8 +481,8 @@ flo_to_s(mrb_state *mrb, mrb_value flt) * call-seq: * float + other -> float * - * Returns a new float which is the sum of float - * and other. + * Returns a new float which is the sum of `float` + * and `other`. */ static mrb_value flo_add(mrb_state *mrb, mrb_value x) @@ -507,8 +507,8 @@ flo_add(mrb_state *mrb, mrb_value x) * call-seq: * float - other -> float * - * Returns a new float which is the difference of float - * and other. + * Returns a new float which is the difference of `float` + * and `other`. */ static mrb_value @@ -534,8 +534,8 @@ flo_sub(mrb_state *mrb, mrb_value x) * call-seq: * float * other -> float * - * Returns a new float which is the product of float - * and other. + * Returns a new float which is the product of `float` + * and `other`. */ static mrb_value @@ -599,7 +599,7 @@ flodivmod(mrb_state *mrb, double x, double y, mrb_float *divp, mrb_float *modp) * flt % other -> float * flt.modulo(other) -> float * - * Return the modulo after division of flt by other. + * Return the modulo after division of `flt` by `other`. * * 6543.21.modulo(137) #=> 104.21 * 6543.21.modulo(137.24) #=> 92.9299999999996 @@ -621,7 +621,7 @@ flo_mod(mrb_state *mrb, mrb_value x) * call-seq: * num.eql?(numeric) -> true or false * - * Returns true if num and numeric are the + * Returns `true` if `num` and `numeric` are the * same type and have equal values. * * 1 == 1.0 #=> true @@ -657,9 +657,9 @@ num_eql(mrb_state *mrb, mrb_value x) * call-seq: * flt == obj -> true or false * - * Returns true only if obj has the same value - * as flt. Contrast this with Float#eql?, which - * requires obj to be a Float. + * Returns `true` only if *obj* has the same value + * as *flt*. Contrast this with `Float#eql?`, which + * requires *obj* to be a `Float`. * * 1.0 == 1 #=> true * @@ -695,7 +695,7 @@ flo_eq(mrb_state *mrb, mrb_value x) * call-seq: * flt.to_f -> self * - * As flt is already a float, returns +self+. + * As `flt` is already a float, returns `self`. */ /* 15.2.9.3.11 */ @@ -703,7 +703,7 @@ flo_eq(mrb_state *mrb, mrb_value x) * call-seq: * flt.infinite? -> nil, -1, +1 * - * Returns nil, -1, or +1 depending on whether flt + * Returns `nil`, -1, or +1 depending on whether *flt* * is finite, -infinity, or +infinity. * * (0.0).infinite? #=> nil @@ -727,9 +727,9 @@ flo_infinite_p(mrb_state *mrb, mrb_value num) * call-seq: * flt.finite? -> true or false * - * Returns true if flt is a valid IEEE floating - * point number (it is not infinite, and nan? is - * false). + * Returns `true` if *flt* is a valid IEEE floating + * point number (it is not infinite, and `nan?` is + * `false`). * */ @@ -825,13 +825,13 @@ flo_rounding(mrb_state *mrb, mrb_value num, double (*func)(double)) * call-seq: * float.floor([ndigits]) -> integer or float * - * Returns the largest number less than or equal to +float+ with - * a precision of +ndigits+ decimal digits (default: 0). + * Returns the largest number less than or equal to `float` with + * a precision of `ndigits` decimal digits (default: 0). * * When the precision is negative, the returned value is an integer - * with at least ndigits.abs trailing zeros. + * with at least `ndigits.abs` trailing zeros. * - * Returns a floating-point number when +ndigits+ is positive, + * Returns a floating-point number when `ndigits` is positive, * otherwise returns an integer. * * 1.2.floor #=> 1 @@ -870,13 +870,13 @@ flo_floor(mrb_state *mrb, mrb_value num) * call-seq: * float.ceil([ndigits]) -> integer or float * - * Returns the smallest number greater than or equal to +float+ with - * a precision of +ndigits+ decimal digits (default: 0). + * Returns the smallest number greater than or equal to `float` with + * a precision of `ndigits` decimal digits (default: 0). * * When the precision is negative, the returned value is an integer - * with at least ndigits.abs trailing zeros. + * with at least `ndigits.abs` trailing zeros. * - * Returns a floating-point number when +ndigits+ is positive, + * Returns a floating-point number when `ndigits` is positive, * otherwise returns an integer. * * 1.2.ceil #=> 2 @@ -916,7 +916,7 @@ flo_ceil(mrb_state *mrb, mrb_value num) * call-seq: * flt.round([ndigits]) -> integer or float * - * Rounds flt to a given precision in decimal digits (default 0 digits). + * Rounds *flt* to a given precision in decimal digits (default 0 digits). * Precision may be negative. Returns a floating-point number when ndigits * is more than zero. * @@ -1022,7 +1022,7 @@ flo_to_i(mrb_state *mrb, mrb_value num) * flt.to_i -> integer * flt.truncate -> integer * - * Returns flt truncated to an Integer. + * Returns *flt* truncated to an `Integer`. */ static mrb_value @@ -1051,7 +1051,7 @@ flo_abs(mrb_state *mrb, mrb_value num) /* * Document-class: Integer * - * Integer is hold whole numbers. + * `Integer` is hold whole numbers. * */ @@ -1064,7 +1064,7 @@ flo_abs(mrb_state *mrb, mrb_value num) * int.to_i -> integer * int.to_int -> integer * - * As int is already an Integer, all these + * As *int* is already an `Integer`, all these * methods simply return the receiver. */ @@ -1142,7 +1142,7 @@ mrb_int_mul(mrb_state *mrb, mrb_value x, mrb_value y) * int * numeric -> numeric_result * * Performs multiplication: the class of the resulting object depends on - * the class of numeric and on the magnitude of the + * the class of `numeric` and on the magnitude of the * result. */ @@ -1186,8 +1186,8 @@ intdivmod(mrb_state *mrb, mrb_int x, mrb_int y, mrb_int *divp, mrb_int *modp) * call-seq: * int % num -> num * - * Returns int modulo other. - * See numeric.divmod for more information. + * Returns `int` modulo `other`. + * See `numeric.divmod` for more information. */ static mrb_value @@ -1234,7 +1234,7 @@ static mrb_value flo_divmod(mrb_state *mrb, mrb_value x); * call-seq: * int.divmod(numeric) -> array * - * See Numeric#divmod. + * See `Numeric#divmod`. */ static mrb_value int_divmod(mrb_state *mrb, mrb_value x) @@ -1291,7 +1291,7 @@ flo_divmod(mrb_state *mrb, mrb_value x) * call-seq: * int == other -> true or false * - * Return true if int equals other + * Return `true` if `int` equals `other` * numerically. * * 1 == 2 #=> false @@ -1585,7 +1585,7 @@ prepare_int_rounding(mrb_state *mrb, mrb_value x) * Returns self. * * When the precision (ndigits) is negative, the returned value is an integer - * with at least ndigits.abs trailing zeros. + * with at least `ndigits.abs` trailing zeros. */ static mrb_value int_ceil(mrb_state *mrb, mrb_value x) @@ -1627,7 +1627,7 @@ int_ceil(mrb_state *mrb, mrb_value x) * Returns self. * * When the precision (ndigits) is negative, the returned value is an integer - * with at least ndigits.abs trailing zeros. + * with at least `ndigits.abs` trailing zeros. */ static mrb_value int_floor(mrb_state *mrb, mrb_value x) @@ -1668,7 +1668,7 @@ int_floor(mrb_state *mrb, mrb_value x) * Returns self. * * When the precision (ndigits) is negative, the returned value is an integer - * with at least ndigits.abs trailing zeros. + * with at least `ndigits.abs` trailing zeros. */ static mrb_value int_round(mrb_state *mrb, mrb_value x) @@ -1732,7 +1732,7 @@ int_round(mrb_state *mrb, mrb_value x) * Returns self. * * When the precision (ndigits) is negative, the returned value is an integer - * with at least ndigits.abs trailing zeros. + * with at least `ndigits.abs` trailing zeros. */ static mrb_value int_truncate(mrb_state *mrb, mrb_value x) @@ -1760,7 +1760,7 @@ int_truncate(mrb_state *mrb, mrb_value x) * call-seq: * int.to_f -> float * - * Converts int to a Float. + * Converts *int* to a `Float`. * */ @@ -1865,7 +1865,7 @@ mrb_int_add(mrb_state *mrb, mrb_value x, mrb_value y) * int + numeric -> numeric_result * * Performs addition: the class of the resulting object depends on - * the class of numeric and on the magnitude of the + * the class of `numeric` and on the magnitude of the * result. */ static mrb_value @@ -1945,7 +1945,7 @@ mrb_int_sub(mrb_state *mrb, mrb_value x, mrb_value y) * int - numeric -> numeric * * Performs subtraction: the class of the resulting object depends on - * the class of numeric and on the magnitude of the + * the class of `numeric` and on the magnitude of the * result. */ static mrb_value @@ -2039,8 +2039,8 @@ mrb_integer_to_str(mrb_state *mrb, mrb_value x, mrb_int base) * call-seq: * int.to_s(base=10) -> string * - * Returns a string containing the representation of int radix - * base (between 2 and 36). + * Returns a string containing the representation of *int* radix + * *base* (between 2 and 36). * * 12345.to_s #=> "12345" * 12345.to_s(2) #=> "11000000111001" @@ -2160,9 +2160,9 @@ int_hash(mrb_state *mrb, mrb_value self) * < => -1 * = => 0 * > => +1 - * Comparison---Returns -1, 0, or +1 depending on whether int is - * less than, equal to, or greater than numeric. This is the - * basis for the tests in Comparable. When the operands are + * Comparison---Returns -1, 0, or +1 depending on whether *int* is + * less than, equal to, or greater than *numeric*. This is the + * basis for the tests in `Comparable`. When the operands are * not comparable, it returns nil instead of raising an exception. */ static mrb_value diff --git a/src/object.c b/src/object.c index d42ea8ca4..49336d957 100644 --- a/src/object.c +++ b/src/object.c @@ -108,7 +108,7 @@ mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2) /* * Document-class: NilClass * - * The class of the singleton object nil. + * The class of the singleton object `nil`. */ /* 15.2.4.3.4 */ @@ -116,7 +116,7 @@ mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2) * call_seq: * nil.nil? -> true * - * Only the object nil responds true to nil?. + * Only the object *nil* responds `true` to `nil?`. */ static mrb_value @@ -152,10 +152,10 @@ nil_inspect(mrb_state *mrb, mrb_value obj) /*********************************************************************** * Document-class: TrueClass * - * The global value true is the only instance of class - * TrueClass and represents a logically true value in + * The global value `true` is the only instance of class + * `TrueClass` and represents a logically true value in * boolean expressions. The class provides operators allowing - * true to be used in logical expressions. + * `true` to be used in logical expressions. */ /* 15.2.5.3.1 */ @@ -163,8 +163,8 @@ nil_inspect(mrb_state *mrb, mrb_value obj) * call-seq: * true & obj -> true or false * - * And---Returns false if obj is - * nil or false, true otherwise. + * And---Returns `false` if *obj* is + * `nil` or `false`, `true` otherwise. */ static mrb_value @@ -182,8 +182,8 @@ true_and(mrb_state *mrb, mrb_value obj) * call-seq: * true ^ obj -> !obj * - * Exclusive Or---Returns true if obj is - * nil or false, false + * Exclusive Or---Returns `true` if *obj* is + * `nil` or `false`, `false` * otherwise. */ @@ -201,7 +201,7 @@ true_xor(mrb_state *mrb, mrb_value obj) * call-seq: * true.to_s -> "true" * - * The string representation of true is "true". + * The string representation of `true` is "true". */ static mrb_value @@ -217,7 +217,7 @@ true_to_s(mrb_state *mrb, mrb_value obj) * call-seq: * true | obj -> true * - * Or---Returns true. As anObject is an argument to + * Or---Returns `true`. As *anObject* is an argument to * a method call, it is always evaluated; there is no short-circuit * evaluation in this case. * @@ -238,10 +238,10 @@ true_or(mrb_state *mrb, mrb_value obj) /* * Document-class: FalseClass * - * The global value false is the only instance of class - * FalseClass and represents a logically false value in + * The global value `false` is the only instance of class + * `FalseClass` and represents a logically false value in * boolean expressions. The class provides operators allowing - * false to participate correctly in logical expressions. + * `false` to participate correctly in logical expressions. * */ @@ -252,7 +252,7 @@ true_or(mrb_state *mrb, mrb_value obj) * false & obj -> false * nil & obj -> false * - * And---Returns false. obj is always + * And---Returns `false`. *obj* is always * evaluated as it is the argument to a method call---there is no * short-circuit evaluation in this case. */ @@ -270,9 +270,9 @@ false_and(mrb_state *mrb, mrb_value obj) * false ^ obj -> true or false * nil ^ obj -> true or false * - * Exclusive Or---If obj is nil or - * false, returns false; otherwise, returns - * true. + * Exclusive Or---If *obj* is `nil` or + * `false`, returns `false`; otherwise, returns + * `true`. * */ @@ -292,8 +292,8 @@ false_xor(mrb_state *mrb, mrb_value obj) * false | obj -> true or false * nil | obj -> true or false * - * Or---Returns false if obj is - * nil or false; true otherwise. + * Or---Returns `false` if *obj* is + * `nil` or `false`; `true` otherwise. */ static mrb_value @@ -485,8 +485,8 @@ mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t) * call-seq: * obj.to_s => string * - * Returns a string representing obj. The default - * to_s prints the object's class and an encoding of the + * Returns a string representing *obj*. The default + * `to_s` prints the object's class and an encoding of the * object id. As a special case, the top-level object that is the * initial execution context of Ruby programs returns "main." */ diff --git a/src/proc.c b/src/proc.c index 129843aa3..676d54eec 100644 --- a/src/proc.c +++ b/src/proc.c @@ -370,7 +370,7 @@ proc_hash(mrb_state *mrb, mrb_value self) * call-seq: * lambda { |...| block } -> a_proc * - * Equivalent to Proc.new, except the resulting Proc objects + * Equivalent to `Proc.new`, except the resulting Proc objects * check the number of parameters passed when called. */ static mrb_value diff --git a/src/range.c b/src/range.c index 552ad9663..9ebea9d93 100644 --- a/src/range.c +++ b/src/range.c @@ -114,7 +114,7 @@ range_ptr_replace(mrb_state *mrb, struct RRange *r, mrb_value beg, mrb_value end * rng.first => obj * rng.begin => obj * - * Returns the first object in rng. + * Returns the first object in `rng`. */ static mrb_value range_beg(mrb_state *mrb, mrb_value range) @@ -127,7 +127,7 @@ range_beg(mrb_state *mrb, mrb_value range) * rng.end => obj * rng.last => obj * - * Returns the object that defines the end of rng. + * Returns the object that defines the end of `rng`. * * (1..10).end #=> 10 * (1...10).end #=> 10 @@ -142,7 +142,7 @@ range_end(mrb_state *mrb, mrb_value range) * call-seq: * range.exclude_end? => true or false * - * Returns true if range excludes its end value. + * Returns `true` if `range` excludes its end value. */ static mrb_value range_excl(mrb_state *mrb, mrb_value range) @@ -154,8 +154,8 @@ range_excl(mrb_state *mrb, mrb_value range) * call-seq: * Range.new(start, end, exclusive=false) => range * - * Constructs a range using the given start and end. If the third - * parameter is omitted or is false, the range will include + * Constructs a range using the given `start` and `end`. If the third + * parameter is omitted or is `false`, the `range` will include * the end object; otherwise, it will be excluded. */ static mrb_value @@ -174,10 +174,10 @@ range_initialize(mrb_state *mrb, mrb_value range) * call-seq: * range == obj => true or false * - * Returns true only if - * 1) obj is a Range, - * 2) obj has equivalent beginning and end items (by comparing them with ==), - * 3) obj has the same #exclude_end? setting as rng. + * Returns `true` only if + * 1) `obj` is a Range, + * 2) `obj` has equivalent beginning and end items (by comparing them with `==`), + * 3) `obj` has the same #exclude_end? setting as `rng`. * * (0..2) == (0..2) #=> true * (0..2) == Range.new(0,2) #=> true @@ -267,7 +267,7 @@ range_to_s(mrb_state *mrb, mrb_value range) * rng.inspect -> string * * Convert this range object to a printable form (using - * inspect to convert the start and end + * `inspect` to convert the start and end * objects). */ static mrb_value @@ -297,9 +297,9 @@ range_inspect(mrb_state *mrb, mrb_value range) * call-seq: * rng.eql?(obj) -> true or false * - * Returns true only if obj is a Range, has equivalent + * Returns `true` only if `obj` is a Range, has equivalent * beginning and end items (by comparing them with #eql?), and has the same - * #exclude_end? setting as rng. + * #exclude_end? setting as `rng`. * * (0..2).eql?(0..2) #=> true * (0..2).eql?(Range.new(0,2)) #=> true diff --git a/src/string.c b/src/string.c index 11ae5a318..082de2d45 100644 --- a/src/string.c +++ b/src/string.c @@ -1096,8 +1096,8 @@ mrb_str_plus(mrb_state *mrb, mrb_value a, mrb_value b) * call-seq: * str + other_str -> new_str * - * Concatenation---Returns a new String containing - * other_str concatenated to str. + * Concatenation---Returns a new `String` containing + * `other_str` concatenated to `str`. * * "Hello from " + self.to_s #=> "Hello from main" */ @@ -1136,7 +1136,7 @@ mrb_str_bytesize(mrb_state *mrb, mrb_value self) * call-seq: * str * integer => new_str * - * Copy---Returns a new String containing integer copies of + * Copy---Returns a new `String` containing `integer` copies of * the receiver. * * "Ho! " * 3 #=> "Ho! Ho! Ho! " @@ -1217,20 +1217,19 @@ mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2) * call-seq: * str <=> other_str => -1, 0, +1 * - * Comparison---Returns -1 if other_str is less than, 0 if - * other_str is equal to, and +1 if other_str is greater than - * str. If the strings are of different lengths, and the strings are + * Comparison---Returns -1 if `other_str` is less than, 0 if + * `other_str` is equal to, and +1 if `other_str` is greater than + * `str`. If the strings are of different lengths, and the strings are * equal when compared up to the shortest length, then the longer string is - * considered greater than the shorter one. If the variable $= is - * false, the comparison is based on comparing the binary values + * considered greater than the shorter one. If the variable `$=` is + * `false`, the comparison is based on comparing the binary values * of each character in the string. In older versions of Ruby, setting - * $= allowed case-insensitive comparisons; this is now deprecated - * in favor of using String#casecmp. + * `$=` allowed case-insensitive comparisons; this is now deprecated + * in favor of using `String#casecmp`. * - * <=> is the basis for the methods <, - * <=, >, >=, and between?, - * included from module Comparable. The method - * String#== does not use Comparable#==. + * `<=>` is the basis for the methods `<`, `<=`, `>`, `>=`, and `between?`, + * included from module `Comparable`. The method `String#==` does not use + * `Comparable#==`. * * "abcdef" <=> "abcde" #=> 1 * "abcdef" <=> "abcdef" #=> 0 @@ -1281,10 +1280,10 @@ mrb_str_equal(mrb_state *mrb, mrb_value str1, mrb_value str2) * str == obj => true or false * * Equality--- - * If obj is not a String, returns false. - * Otherwise, returns false or true + * If `obj` is not a `String`, returns `false`. + * Otherwise, returns `false` or `true` * - * caution:if str <=> obj returns zero. + * caution:if `str` `<=>` `obj` returns zero. */ static mrb_value mrb_str_equal_m(mrb_state *mrb, mrb_value str1) @@ -1416,17 +1415,17 @@ mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value idx, mrb_value alen) * str.slice(range) => new_str or nil * str.slice(other_str) => new_str or nil * - * Element Reference---If passed a single Integer, returns the code - * of the character at that position. If passed two Integer + * Element Reference---If passed a single `Integer`, returns the code + * of the character at that position. If passed two `Integer` * objects, returns a substring starting at the offset given by the first, and * a length given by the second. If given a range, a substring containing * characters at offsets given by the range is returned. In all three cases, if - * an offset is negative, it is counted from the end of str. Returns - * nil if the initial offset falls outside the string, the length + * an offset is negative, it is counted from the end of *str*. Returns + * `nil` if the initial offset falls outside the string, the length * is negative, or the beginning of the range is greater than the end. * - * If a String is given, that string is returned if it occurs in - * str. In both cases, nil is returned if there is no + * If a `String` is given, that string is returned if it occurs in + * *str*. In both cases, `nil` is returned if there is no * match. * * a = "hello there" @@ -1612,9 +1611,9 @@ mrb_str_aset(mrb_state *mrb, mrb_value str, mrb_value idx, mrb_value alen, mrb_v * str[range] = replace * str[other_str] = replace * - * Modify +self+ by replacing the content of +self+. + * Modify `self` by replacing the content of `self`. * The portion of the string affected is determined using the same criteria as +String#[]+. - * The return value of this expression is +replace+. + * The return value of this expression is `replace`. */ static mrb_value mrb_str_aset_m(mrb_state *mrb, mrb_value str) @@ -1638,8 +1637,8 @@ mrb_str_aset_m(mrb_state *mrb, mrb_value str) * call-seq: * str.capitalize! => str or nil * - * Modifies str by converting the first character to uppercase and the - * remainder to lowercase. Returns nil if no changes are made. + * Modifies *str* by converting the first character to uppercase and the + * remainder to lowercase. Returns `nil` if no changes are made. * * a = "hello" * a.capitalize! #=> "Hello" @@ -1676,7 +1675,7 @@ mrb_str_capitalize_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.capitalize => new_str * - * Returns a copy of str with the first character converted to uppercase + * Returns a copy of *str* with the first character converted to uppercase * and the remainder to lowercase. * * "hello".capitalize #=> "Hello" @@ -1698,8 +1697,8 @@ mrb_str_capitalize(mrb_state *mrb, mrb_value self) * call-seq: * str.chomp!(separator="\n") => str or nil * - * Modifies str in place as described for String#chomp, - * returning str, or nil if no modifications were made. + * Modifies *str* in place as described for `String#chomp`, + * returning *str*, or `nil` if no modifications were made. */ static mrb_value mrb_str_chomp_bang(mrb_state *mrb, mrb_value str) @@ -1774,10 +1773,10 @@ mrb_str_chomp_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.chomp(separator="\n") => new_str * - * Returns a new String with the given record separator removed - * from the end of str (if present). chomp also removes - * carriage return characters (that is it will remove \n, - * \r, and \r\n). + * Returns a new `String` with the given record separator removed + * from the end of *str* (if present). `chomp` also removes + * carriage return characters (that is it will remove `\n`, + * `\r`, and `\r\n`). * * "hello".chomp #=> "hello" * "hello\n".chomp #=> "hello" @@ -1802,9 +1801,9 @@ mrb_str_chomp(mrb_state *mrb, mrb_value self) * call-seq: * str.chop! => str or nil * - * Processes str as for String#chop, returning str, - * or nil if str is the empty string. See also - * String#chomp!. + * Processes *str* as for `String#chop`, returning *str*, + * or `nil` if *str* is the empty string. See also + * `String#chomp!`. */ static mrb_value mrb_str_chop_bang(mrb_state *mrb, mrb_value str) @@ -1844,10 +1843,10 @@ mrb_str_chop_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.chop => new_str * - * Returns a new String with the last character removed. If the - * string ends with \r\n, both characters are removed. Applying - * chop to an empty string returns an empty - * string. String#chomp is often a safer alternative, as it leaves + * Returns a new `String` with the last character removed. If the + * string ends with `\r\n`, both characters are removed. Applying + * `chop` to an empty string returns an empty + * string. `String#chomp` is often a safer alternative, as it leaves * the string unchanged if it doesn't end in a record separator. * * "string\r\n".chop #=> "string" @@ -1870,7 +1869,7 @@ mrb_str_chop(mrb_state *mrb, mrb_value self) * call-seq: * str.downcase! => str or nil * - * Downcases the contents of str, returning nil if no + * Downcases the contents of *str*, returning `nil` if no * changes were made. */ static mrb_value @@ -1900,7 +1899,7 @@ mrb_str_downcase_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.downcase => new_str * - * Returns a copy of str with all uppercase letters replaced with their + * Returns a copy of *str* with all uppercase letters replaced with their * lowercase counterparts. The operation is locale insensitive---only * characters 'A' to 'Z' are affected. * @@ -1921,7 +1920,7 @@ mrb_str_downcase(mrb_state *mrb, mrb_value self) * call-seq: * str.empty? => true or false * - * Returns true if str has a length of zero. + * Returns `true` if *str* has a length of zero. * * "hello".empty? #=> false * "".empty? #=> true @@ -2031,7 +2030,7 @@ mrb_str_hash_m(mrb_state *mrb, mrb_value self) * str.include? other_str => true or false * str.include? int => true or false * - * Returns true if str contains the given string or + * Returns `true` if *str* contains the given string or * character. * * "hello".include? "lo" #=> true @@ -2053,8 +2052,8 @@ mrb_str_include(mrb_state *mrb, mrb_value self) * call-seq: * str.byteindex(substring, offset = 0) -> integer or nil * - * Returns the \Integer byte-based index of the first occurrence of the given +substring+, - * or +nil+ if none found: + * Returns the \Integer byte-based index of the first occurrence of the given `substring`, + * or `nil` if none found: * * 'foo'.byteindex('f') # => 0 * 'foo'.byteindex('oo') # => 1 @@ -2087,7 +2086,7 @@ mrb_str_byteindex_m(mrb_state *mrb, mrb_value str) * str.index(substring [, offset]) => int or nil * * Returns the index of the first occurrence of the given - * substring. Returns nil if not found. + * *substring*. Returns `nil` if not found. * If the second parameter is present, it * specifies the position in the string to begin the search. * @@ -2149,7 +2148,7 @@ mrb_str_replace(mrb_state *mrb, mrb_value str) * call-seq: * String.new(str="") => new_str * - * Returns a new string object containing a copy of str. + * Returns a new string object containing a copy of *str*. */ static mrb_value mrb_str_init(mrb_state *mrb, mrb_value self) @@ -2170,7 +2169,7 @@ mrb_str_init(mrb_state *mrb, mrb_value self) * str.intern => symbol * str.to_sym => symbol * - * Returns the Symbol corresponding to str, creating the + * Returns the `Symbol` corresponding to *str*, creating the * symbol if it did not previously exist. * * "Koala".intern #=> :Koala @@ -2180,7 +2179,7 @@ mrb_str_init(mrb_state *mrb, mrb_value self) * s == :@cat #=> true * * This can also be used to create symbols that cannot be represented using the - * :xxx notation. + * `:xxx` notation. * * 'cat and dog'.to_sym #=> :"cat and dog" */ @@ -2282,7 +2281,7 @@ str_reverse(char *p, char *e) * call-seq: * str.reverse! => str * - * Reverses str in place. + * Reverses *str* in place. */ static mrb_value mrb_str_reverse_bang(mrb_state *mrb, mrb_value str) @@ -2327,7 +2326,7 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.reverse => new_str * - * Returns a new string with the characters from str in reverse order. + * Returns a new string with the characters from *str* in reverse order. * * "stressed".reverse #=> "desserts" */ @@ -2343,8 +2342,8 @@ mrb_str_reverse(mrb_state *mrb, mrb_value str) * call-seq: * byterindex(substring, offset = self.bytesize) -> integer or nil * - * Returns the \Integer byte-based index of the _last_ occurrence of the given +substring+, - * or +nil+ if none found: + * Returns the \Integer byte-based index of the _last_ occurrence of the given `substring`, + * or `nil` if none found: * * 'foo'.byterindex('f') # => 0 * 'foo'.byterindex('o') # => 2 @@ -2382,8 +2381,8 @@ mrb_str_byterindex_m(mrb_state *mrb, mrb_value str) * call-seq: * str.rindex(substring [, offset]) => int or nil * - * Returns the index of the last occurrence of the given substring. - * Returns nil if not found. If the second parameter is + * Returns the index of the last occurrence of the given *substring*. + * Returns `nil` if not found. If the second parameter is * present, it specifies the position in the string to end the * search---characters beyond this point will not be considered. * @@ -2436,20 +2435,20 @@ mrb_str_rindex_m(mrb_state *mrb, mrb_value str) * call-seq: * str.split(separator=nil, [limit]) => anArray * - * Divides str into substrings based on a delimiter, returning an array + * Divides *str* into substrings based on a delimiter, returning an array * of these substrings. * - * If separator is a String, then its contents are used as - * the delimiter when splitting str. If separator is a single - * space, str is split on whitespace, with leading whitespace and runs + * If *separator* is a `String`, then its contents are used as + * the delimiter when splitting *str*. If *separator* is a single + * space, *str* is split on whitespace, with leading whitespace and runs * of contiguous whitespace characters ignored. * - * If separator is omitted or nil (which is the default), - * str is split on whitespace as if ' ' were specified. + * If *separator* is omitted or `nil` (which is the default), + * *str* is split on whitespace as if ' ' were specified. * - * If the limit parameter is omitted, trailing null fields are - * suppressed. If limit is a positive number, at most that number of - * fields will be returned (if limit is 1, the entire + * If the *limit* parameter is omitted, trailing null fields are + * suppressed. If *limit* is a positive number, at most that number of + * fields will be returned (if *limit* is `1`, the entire * string is returned as the only entry in an array). If negative, there is no * limit to the number of fields returned, and trailing null fields are not * suppressed. @@ -2842,10 +2841,10 @@ mrb_str_to_integer(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badchec * call-seq: * str.to_i(base=10) => integer * - * Returns the result of interpreting leading characters in str as an - * integer base base (between 2 and 36). Extraneous characters past the + * Returns the result of interpreting leading characters in *str* as an + * integer base *base* (between 2 and 36). Extraneous characters past the * end of a valid number are ignored. If there is not a valid number at the - * start of str, 0 is returned. This method never raises an + * start of *str*, `0` is returned. This method never raises an * exception. * * "12345".to_i #=> 12345 @@ -2982,10 +2981,10 @@ mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck) * call-seq: * str.to_f => float * - * Returns the result of interpreting leading characters in str as a + * Returns the result of interpreting leading characters in *str* as a * floating-point number. Extraneous characters past the end of a valid number - * are ignored. If there is not a valid number at the start of str, - * 0.0 is returned. This method never raises an exception. + * are ignored. If there is not a valid number at the start of *str*, + * `0.0` is returned. This method never raises an exception. * * "123.45e1".to_f #=> 1234.5 * "45.67 degrees".to_f #=> 45.67 @@ -3019,7 +3018,7 @@ mrb_str_to_s(mrb_state *mrb, mrb_value self) * call-seq: * str.upcase! => str or nil * - * Upcases the contents of str, returning nil if no changes + * Upcases the contents of *str*, returning `nil` if no changes * were made. */ static mrb_value @@ -3049,7 +3048,7 @@ mrb_str_upcase_bang(mrb_state *mrb, mrb_value str) * call-seq: * str.upcase => new_str * - * Returns a copy of str with all lowercase letters replaced with their + * Returns a copy of *str* with all lowercase letters replaced with their * uppercase counterparts. The operation is locale insensitive---only * characters 'a' to 'z' are affected. * @@ -3069,8 +3068,8 @@ mrb_str_upcase(mrb_state *mrb, mrb_value self) * call-seq: * str.dump -> new_str * - * Produces a version of str with all nonprinting characters replaced by - * \nnn notation and all special characters escaped. + * Produces a version of *str* with all nonprinting characters replaced by + * `\nnn` notation and all special characters escaped. */ mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str) @@ -3228,7 +3227,7 @@ mrb_str_bytes(mrb_state *mrb, mrb_value str) * call-seq: * str.getbyte(index) -> 0 .. 255 * - * returns the indexth byte as an integer. + * returns the *index*th byte as an integer. */ static mrb_value mrb_str_getbyte(mrb_state *mrb, mrb_value str) @@ -3248,7 +3247,7 @@ mrb_str_getbyte(mrb_state *mrb, mrb_value str) * call-seq: * str.setbyte(index, integer) -> integer * - * modifies the indexth byte as integer. + * modifies the *index*th byte as *integer*. */ static mrb_value mrb_str_setbyte(mrb_state *mrb, mrb_value str) @@ -3281,8 +3280,8 @@ mrb_str_setbyte(mrb_state *mrb, mrb_value str) * objects, returns a substring starting at the offset given by the first, and * a length given by the second. If given a Range, a substring containing * bytes at offsets given by the range is returned. In all three cases, if - * an offset is negative, it is counted from the end of str. Returns - * nil if the initial offset falls outside the string, the length + * an offset is negative, it is counted from the end of *str*. Returns + * `nil` if the initial offset falls outside the string, the length * is negative, or the beginning of the range is greater than the end. * The encoding of the resulted string keeps original encoding. * @@ -3427,13 +3426,15 @@ str_bytesplice(mrb_state *mrb, mrb_value str, mrb_int idx1, mrb_int len1, mrb_va * bytesplice(range, str) -> string * bytesplice(range, str, str_range) -> string * - * Replaces some or all of the content of +self+ with +str+, and returns +self+. + * Replaces some or all of the content of `self` with `str`, and returns `self`. * The portion of the string affected is determined using - * the same criteria as String#byteslice, except that +length+ cannot be omitted. + * the same criteria as String#byteslice, except that `length` cannot be omitted. * If the replacement string is not the same length as the text it is replacing, * the string will be adjusted accordingly. * - * If +str_index+ and +str_length+, or +str_range+ are given, the content of +self+ is replaced by str.byteslice(str_index, str_length) or str.byteslice(str_range); however the substring of +str+ is not allocated as a new string. + * If `str_index` and `str_length`, or `str_range` are given, the content of `self` + * is replaced by str.byteslice(str_index, str_length) or str.byteslice(str_range); + * however the substring of `str` is not allocated as a new string. * * The form that take an Integer will raise an IndexError if the value is out * of range; the Range form will raise a RangeError. diff --git a/src/symbol.c b/src/symbol.c index 3c9e545fd..530151e81 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -468,16 +468,16 @@ mrb_init_symtbl(mrb_state *mrb) /********************************************************************** * Document-class: Symbol * - * Symbol objects represent names and some strings + * `Symbol` objects represent names and some strings * inside the Ruby - * interpreter. They are generated using the :name and - * :"string" literals - * syntax, and by the various to_sym methods. The same - * Symbol object will be created for a given name or string + * interpreter. They are generated using the `:name` and + * `:"string"` literals + * syntax, and by the various `to_sym` methods. The same + * `Symbol` object will be created for a given name or string * for the duration of a program's execution, regardless of the context - * or meaning of that name. Thus if Fred is a constant in + * or meaning of that name. Thus if `Fred` is a constant in * one context, a method in another, and a class in a third, the - * Symbol :Fred will be the same object in + * `Symbol` `:Fred` will be the same object in * all three contexts. * * module One @@ -504,7 +504,7 @@ mrb_init_symtbl(mrb_state *mrb) * call-seq: * sym.to_s -> string * - * Returns the name or string corresponding to sym. + * Returns the name or string corresponding to *sym*. * * :fred.to_s #=> "fred" */ @@ -518,7 +518,7 @@ sym_to_s(mrb_state *mrb, mrb_value sym) * call-seq: * sym.name -> string * - * Returns the name or string corresponding to sym. Unlike #to_s, the + * Returns the name or string corresponding to *sym*. Unlike #to_s, the * returned string is frozen. * * :fred.name #=> "fred" @@ -546,8 +546,8 @@ sym_name(mrb_state *mrb, mrb_value vsym) * sym.to_sym -> sym * sym.intern -> sym * - * In general, to_sym returns the Symbol corresponding - * to an object. As sym is already a symbol, self is returned + * In general, `to_sym` returns the `Symbol` corresponding + * to an object. As *sym* is already a symbol, `self` is returned * in this case. */ @@ -556,7 +556,7 @@ sym_name(mrb_state *mrb, mrb_value vsym) * call-seq: * sym.inspect -> string * - * Returns the representation of sym as a symbol literal. + * Returns the representation of *sym* as a symbol literal. * * :fred.inspect #=> ":fred" */ diff --git a/src/variable.c b/src/variable.c index e40ede909..dc28a0aa5 100644 --- a/src/variable.c +++ b/src/variable.c @@ -689,7 +689,7 @@ cv_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p) * call-seq: * mod.class_variables(inherit=true) -> array * - * Returns an array of the names of class variables in mod. + * Returns an array of the names of class variables in *mod*. * * class One * @@var1 = 1 diff --git a/src/vm.c b/src/vm.c index 2772b09b7..f6146f121 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1059,8 +1059,8 @@ send_method(mrb_state *mrb, mrb_value self, mrb_bool pub) * obj.__send__(symbol [, args...]) -> obj * * Invokes the method identified by _symbol_, passing it any - * arguments specified. You can use __send__ if the name - * +send+ clashes with an existing method in _obj_. + * arguments specified. You can use `__send__` if the name + * `send` clashes with an existing method in _obj_. * * class Klass * def hello(*args) @@ -1146,7 +1146,7 @@ eval_under(mrb_state *mrb, mrb_value self, mrb_value blk, struct RClass *c) * mod.module_eval {| | block } -> obj * * Evaluates block in the context of _mod_. This can - * be used to add methods to a class. module_eval returns + * be used to add methods to a class. `module_eval` returns * the result of evaluating its argument. */ mrb_value @@ -1166,10 +1166,10 @@ mrb_mod_module_eval(mrb_state *mrb, mrb_value mod) * obj.instance_eval {| | block } -> obj * * Evaluates the given block,within the context of the receiver (_obj_). - * In order to set the context, the variable +self+ is set to _obj_ while + * In order to set the context, the variable `self` is set to _obj_ while * the code is executing, giving the code access to _obj_'s - * instance variables. In the version of instance_eval - * that takes a +String+, the optional second and third + * instance variables. In the version of `instance_eval` + * that takes a `String`, the optional second and third * parameters supply a filename and starting line number that are used * when reporting compilation errors. * diff --git a/test/assert.rb b/test/assert.rb index 7563099e8..b5e61e740 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -245,25 +245,25 @@ def _assert_operator(affirmed, obj1, op, obj2 = $undefined, msg = nil) end ## -# Fail unless +str+ matches against +pattern+. +# Fail unless `str` matches against `pattern`. # -# +pattern+ is interpreted as pattern for File.fnmatch?. It may contain the +# `pattern` is interpreted as pattern for File.fnmatch?. It may contain the # following metacharacters: # -# * :: +# `*` :: # Matches any string. # -# ? :: +# `?` :: # Matches any one character. # -# [_SET_], [^_SET_] ([!_SET_]) :: +# `[_SET_]`, `[^_SET_]` (`[!_SET_]`) :: # Matches any one character in _SET_. Behaves like character sets in -# Regexp, including set negation ([^a-z]). +# Regexp, including set negation (`[^a-z]`). # -# {_A_,_B_} :: +# `{_A_,_B_}` :: # Matches pattern _A_ or pattern _B_. # -# \ :: +# ` \ ` :: # Escapes the next character. def assert_match(*args); _assert_match(true, *args) end def assert_not_match(*args); _assert_match(false, *args) end @@ -275,7 +275,7 @@ def _assert_match(affirmed, pattern, str, msg = nil) end ## -# Fails unless +obj+ is a kind of +cls+. +# Fails unless `obj` is a kind of `cls`. def assert_kind_of(cls, obj, msg = nil) unless ret = obj.kind_of?(cls) diff = " Expected #{obj.inspect} to be a kind of #{cls}, not #{obj.class}." @@ -284,7 +284,7 @@ def assert_kind_of(cls, obj, msg = nil) end ## -# Fails unless +exp+ is equal to +act+ in terms of a Float +# Fails unless `exp` is equal to `act` in terms of a Float def assert_float(exp, act, msg = nil) e, a = exp.to_f, act.to_f if e.finite? && a.finite? && (n = (e - a).abs) > Mrbtest::FLOAT_TOLERANCE