summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/mruby-array-ext/src/array.c4
-rw-r--r--mrbgems/mruby-enum-ext/mrblib/enum.rb22
-rw-r--r--mrbgems/mruby-enumerator/mrblib/enumerator.rb34
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb14
-rw-r--r--mrbgems/mruby-kernel-ext/src/kernel.c8
-rw-r--r--mrbgems/mruby-math/src/math.c5
6 files changed, 43 insertions, 44 deletions
diff --git a/mrbgems/mruby-array-ext/src/array.c b/mrbgems/mruby-array-ext/src/array.c
index 79dadbee5..37d8739b6 100644
--- a/mrbgems/mruby-array-ext/src/array.c
+++ b/mrbgems/mruby-array-ext/src/array.c
@@ -119,8 +119,8 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self)
* Returns the result of interpreting <i>aray</i> as an array of
* <tt>[key, value]</tt> paris.
*
- * [[:foo, :bar], [1, 2]].to_h
- * # => {:foo => :bar, 1 => 2}
+ * [[:foo, :bar], [1, 2]].to_h
+ * # => {:foo => :bar, 1 => 2}
*
* @mrbgem mruby-array-ext
*/
diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb
index 7efec89c9..b41eaaf1f 100644
--- a/mrbgems/mruby-enum-ext/mrblib/enum.rb
+++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb
@@ -78,10 +78,10 @@ module Enumerable
# 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.
+ # If no block is given, an enumerator is returned instead.
#
- # a = [1, 2, 3, 4, 5, 0]
- # a.take_while {|i| i < 3 } #=> [1, 2]
+ # a = [1, 2, 3, 4, 5, 0]
+ # a.take_while {|i| i < 3 } #=> [1, 2]
#
# @mrbgem mruby-enum-ext
def take_while(&block)
@@ -96,13 +96,12 @@ module Enumerable
end
##
- # call-seq:
- # enum.each_cons(n) {...} -> nil
- #
# Iterates the given block for each array of consecutive <n>
# elements.
#
- # e.g.:
+ # @return [nil]
+ #
+ # @example
# (1..10).each_cons(3) {|a| p a}
# # outputs below
# [1, 2, 3]
@@ -130,12 +129,11 @@ module Enumerable
end
##
- # call-seq:
- # enum.each_slice(n) {...} -> nil
- #
# Iterates the given block for each slice of <n> elements.
#
- # e.g.:
+ # @return [nil]
+ #
+ # @example
# (1..10).each_slice(3) {|a| p a}
# # outputs below
# [1, 2, 3]
@@ -170,7 +168,7 @@ module Enumerable
# block, and values are arrays of elements in <i>enum</i>
# corresponding to the key.
#
- # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
+ # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
#
# @mrbgem mruby-enum-ext
def group_by(&block)
diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb
index d09ffaff8..e9300462a 100644
--- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb
+++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb
@@ -581,27 +581,27 @@ module Kernel
#
# Here is such an example, with parameter passing and a sizing block:
#
- # module Enumerable
- # # a generic method to repeat the values of any enumerable
- # def repeat(n)
- # raise ArgumentError, "#{n} is negative!" if n < 0
- # unless block_given?
- # return to_enum(__method__, n) do # __method__ is :repeat here
- # sz = size # Call size and multiply by n...
- # sz * n if sz # but return nil if size itself is nil
+ # module Enumerable
+ # # a generic method to repeat the values of any enumerable
+ # def repeat(n)
+ # raise ArgumentError, "#{n} is negative!" if n < 0
+ # unless block_given?
+ # return to_enum(__method__, n) do # __method__ is :repeat here
+ # sz = size # Call size and multiply by n...
+ # sz * n if sz # but return nil if size itself is nil
+ # end
+ # end
+ # each do |*val|
+ # n.times { yield *val }
# end
- # end
- # each do |*val|
- # n.times { yield *val }
# end
# end
- # end
#
- # %i[hello world].repeat(2) { |w| puts w }
- # # => Prints 'hello', 'hello', 'world', 'world'
- # enum = (1..14).repeat(3)
- # # => returns an Enumerator when called without a block
- # enum.first(4) # => [1, 1, 1, 2]
+ # %i[hello world].repeat(2) { |w| puts w }
+ # # => Prints 'hello', 'hello', 'world', 'world'
+ # enum = (1..14).repeat(3)
+ # # => returns an Enumerator when called without a block
+ # enum.first(4) # => [1, 1, 1, 2]
#
def to_enum(meth=:each, *args)
Enumerator.new self, meth, *args
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb
index 28ffd8146..415d8ea8f 100644
--- a/mrbgems/mruby-hash-ext/mrblib/hash.rb
+++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb
@@ -7,22 +7,22 @@ class Hash
##
# call-seq:
- # Hash[ key, value, ... ] -> new_hash
- # Hash[ [ [key, value], ... ] ] -> new_hash
- # Hash[ object ] -> new_hash
+ # Hash[ key, value, ... ] -> new_hash
+ # Hash[ [ [key, value], ... ] ] -> new_hash
+ # Hash[ object ] -> new_hash
#
# Creates a new hash populated with the given objects.
#
- # Similar to the literal <code>{ _key_ => _value_, ... }</code>. In the first
+ # Similar to the literal `{ _key_ => _value_, ... }`. In the first
# form, keys and values occur in pairs, so there must be an even number of
# arguments.
#
# The second and third form take a single argument which is either an array
# of key-value pairs or an object convertible to a hash.
#
- # Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200}
- # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200}
- # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200}
+ # Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200}
+ # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200}
+ # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200}
#
# @mrbgem mruby-hash-ext
def self.[](*object)
diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c
index a0f78e471..a00fa9d6f 100644
--- a/mrbgems/mruby-kernel-ext/src/kernel.c
+++ b/mrbgems/mruby-kernel-ext/src/kernel.c
@@ -146,10 +146,10 @@ mrb_f_array(mrb_state *mrb, mrb_value self)
* <i>arg</i><code>.to_hash</code>. Returns an empty <code>Hash</code> when
* <i>arg</i> is <tt>nil</tt> or <tt>[]</tt>.
*
- * Hash([]) #=> {}
- * Hash(nil) #=> {}
- * Hash(key: :value) #=> {:key => :value}
- * Hash([1, 2, 3]) #=> TypeError
+ * Hash([]) #=> {}
+ * Hash(nil) #=> {}
+ * Hash(key: :value) #=> {:key => :value}
+ * Hash([1, 2, 3]) #=> TypeError
*
* @mrbgem mruby-kernel-ext
*/
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c
index 8cbc2544e..a94c48c7b 100644
--- a/mrbgems/mruby-math/src/math.c
+++ b/mrbgems/mruby-math/src/math.c
@@ -236,7 +236,8 @@ math_tan(mrb_state *mrb, mrb_value obj)
* call-seq:
* Math.asin(x) -> float
*
- * Computes the arc sine of <i>x</i>. Returns -{PI/2} .. {PI/2}.
+ * Computes the arc sine of <i>x</i>.
+ * @return computed value between `-(PI/2)` and `(PI/2)`.
*/
static mrb_value
math_asin(mrb_state *mrb, mrb_value obj)
@@ -276,7 +277,7 @@ math_acos(mrb_state *mrb, mrb_value obj)
* call-seq:
* Math.atan(x) -> float
*
- * Computes the arc tangent of <i>x</i>. Returns -{PI/2} .. {PI/2}.
+ * Computes the arc tangent of <i>x</i>. Returns `-(PI/2) .. (PI/2)`.
*/
static mrb_value
math_atan(mrb_state *mrb, mrb_value obj)