From de0ef1a9dfd9f966ad7e667788f3e333944d959e Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 28 Mar 2019 03:33:35 +0000 Subject: [DOC] fix markups [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 102 +++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 49 insertions(+), 53 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 20efadc4ef..e63b8469ac 100644 --- a/proc.c +++ b/proc.c @@ -755,10 +755,10 @@ proc_new(VALUE klass, int8_t is_lambda) * Proc.new {|...| block } -> a_proc * Proc.new -> a_proc * - * Creates a new Proc object, bound to the current - * context. Proc::new may be called without a block only - * within a method with an attached block, in which case that block is - * converted to the Proc object. + * Creates a new Proc object, bound to the current context. Proc::new + * may be called without a block only within a method with an + * attached block, in which case that block is converted to the Proc + * object. * * def proc_from * Proc.new @@ -780,7 +780,7 @@ rb_proc_s_new(int argc, VALUE *argv, VALUE klass) * call-seq: * proc { |...| block } -> a_proc * - * Equivalent to Proc.new. + * Equivalent to Proc.new. */ VALUE @@ -793,8 +793,8 @@ rb_block_proc(void) * call-seq: * lambda { |...| block } -> a_proc * - * Equivalent to Proc.new, except the resulting Proc objects - * check the number of parameters passed when called. + * Equivalent to Proc.new, except the resulting Proc objects check the + * number of parameters passed when called. */ VALUE @@ -839,11 +839,11 @@ rb_block_lambda(void) * Note that prc.() invokes prc.call() with * the parameters given. It's syntactic sugar to hide "call". * - * For procs created using lambda or ->() an error - * is generated if the wrong number of parameters are passed to the proc. - * For procs created using Proc.new or Kernel.proc, - * extra parameters are silently discarded and missing parameters are - * set to +nil+. + * For procs created using #lambda or ->() an error is + * generated if the wrong number of parameters are passed to the + * proc. For procs created using Proc.new or Kernel.proc, extra + * parameters are silently discarded and missing parameters are set + * to +nil+. * * a_proc = proc {|a,b| [a,b] } * a_proc.call(1) #=> [1, nil] @@ -921,8 +921,8 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE passed_pr * in this latter case, returns n. * Keyword arguments will be considered as a single additional argument, * that argument being mandatory if any keyword argument is mandatory. - * A proc with no argument declarations - * is the same as a block declaring || as its arguments. + * A #proc with no argument declarations is the same as a block + * declaring || as its arguments. * * proc {}.arity #=> 0 * proc { || }.arity #=> 0 @@ -1302,9 +1302,8 @@ proc_to_s(VALUE self) * call-seq: * prc.to_proc -> proc * - * Part of the protocol for converting objects to Proc - * objects. Instances of class Proc simply return - * themselves. + * Part of the protocol for converting objects to Proc objects. + * Instances of class Proc simply return themselves. */ static VALUE @@ -1476,12 +1475,11 @@ method_entry_defined_class(const rb_method_entry_t *me) * * Document-class: Method * - * Method objects are created by Object#method, and are - * associated with a particular object (not just with a class). They - * may be used to invoke the method within the object, and as a block - * associated with an iterator. They may also be unbound from one - * object (creating an UnboundMethod) and bound to - * another. + * Method objects are created by Object#method, and are associated + * with a particular object (not just with a class). They may be + * used to invoke the method within the object, and as a block + * associated with an iterator. They may also be unbound from one + * object (creating an UnboundMethod) and bound to another. * * class Thing * def square(n) @@ -1567,8 +1565,8 @@ method_hash(VALUE method) * meth.unbind -> unbound_method * * Dissociates meth from its current receiver. The resulting - * UnboundMethod can subsequently be bound to a new object - * of the same class (see UnboundMethod). + * UnboundMethod can subsequently be bound to a new object of the + * same class (see UnboundMethod). */ static VALUE @@ -1711,10 +1709,9 @@ obj_method(VALUE obj, VALUE vid, int scope) * obj.method(sym) -> method * * Looks up the named method as a receiver in obj, returning a - * Method object (or raising NameError). The - * Method object acts as a closure in obj's object - * instance, so instance variables and the value of self - * remain available. + * Method object (or raising NameError). The Method object acts as a + * closure in obj's object instance, so instance variables and + * the value of self remain available. * * class Demo * def initialize(n) @@ -1733,8 +1730,8 @@ obj_method(VALUE obj, VALUE vid, int scope) * m = l.method("hello") * m.call #=> "Hello, @iv = Fred" * - * Note that Method implements to_proc method, - * which means it can be used with iterators. + * Note that Method implements to_proc method, which + * means it can be used with iterators. * * [ 1, 2, 3 ].each(&method(:puts)) # => prints 3 lines to stdout * @@ -1881,7 +1878,7 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * Defines an instance method in the receiver. The _method_ * parameter can be a +Proc+, a +Method+ or an +UnboundMethod+ object. * If a block is specified, it is used as the method body. This block - * is evaluated using instance_eval. + * is evaluated using #instance_eval. * * class A * def fred @@ -2190,17 +2187,16 @@ rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE passe * * Document-class: UnboundMethod * - * Ruby supports two forms of objectified methods. Class - * Method is used to represent methods that are associated - * with a particular object: these method objects are bound to that - * object. Bound method objects for an object can be created using - * Object#method. + * Ruby supports two forms of objectified methods. Class Method is + * used to represent methods that are associated with a particular + * object: these method objects are bound to that object. Bound + * method objects for an object can be created using Object#method. * * Ruby also supports unbound methods; methods objects that are not - * associated with a particular object. These can be created either by - * calling Module#instance_method or by calling - * unbind on a bound method object. The result of both of - * these is an UnboundMethod object. + * associated with a particular object. These can be created either + * by calling Module#instance_method or by calling #unbind on a bound + * method object. The result of both of these is an UnboundMethod + * object. * * Unbound methods can only be called after they are bound to an * object. That object must be a kind_of? the method's original @@ -2246,9 +2242,9 @@ rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE passe * call-seq: * umeth.bind(obj) -> method * - * Bind umeth to obj. If Klass was the class - * from which umeth was obtained, - * obj.kind_of?(Klass) must be true. + * Bind umeth to obj. If Klass was the class from which + * umeth was obtained, obj.kind_of?(Klass) must + * be true. * * class A * def test @@ -2725,7 +2721,7 @@ rb_proc_new( * call-seq: * meth.to_proc -> proc * - * Returns a Proc object corresponding to this method. + * Returns a Proc object corresponding to this method. */ static VALUE @@ -3399,7 +3395,7 @@ rb_method_compose_to_right(VALUE self, VALUE g) * end * C.new.f(1,2) #=> ArgumentError * - * The wrapper def2 receives body as a non-lambda proc, + * The wrapper def2 receives _body_ as a non-lambda proc, * yet defines a method which has normal semantics. * * == Conversion of other objects to procs @@ -3552,16 +3548,16 @@ Init_Proc(void) } /* - * Objects of class Binding encapsulate the execution - * context at some particular place in the code and retain this context - * for future use. The variables, methods, value of self, - * and possibly an iterator block that can be accessed in this context + * Objects of class Binding encapsulate the execution context at some + * particular place in the code and retain this context for future + * use. The variables, methods, value of self, and + * possibly an iterator block that can be accessed in this context * are all retained. Binding objects can be created using - * Kernel#binding, and are made available to the callback - * of Kernel#set_trace_func. + * Kernel#binding, and are made available to the callback of + * Kernel#set_trace_func. * * These binding objects can be passed as the second argument of the - * Kernel#eval method, establishing an environment for the + * Kernel#eval method, establishing an environment for the * evaluation. * * class Demo -- cgit v1.2.3