Bug #14483 ยป method-docs.patch
proc.c | ||
---|---|---|
return proc_new(rb_cProc, TRUE);
|
||
}
|
||
/* Document-method: ===
|
||
/* Document-method: Proc#===
|
||
*
|
||
* call-seq:
|
||
* proc === obj -> result_of_proc
|
||
... | ... | |
/* CHECKME: are the argument checking semantics correct? */
|
||
/*
|
||
* Document-method: []
|
||
* Document-method: call
|
||
* Document-method: yield
|
||
* Document-method: Proc#[]
|
||
* Document-method: Proc#call
|
||
* Document-method: Proc#yield
|
||
*
|
||
* call-seq:
|
||
* prc.call(params,...) -> obj
|
||
... | ... | |
* meth.call(9) #=> 81
|
||
* [ 1, 2, 3 ].collect(&meth) #=> [1, 4, 9]
|
||
*
|
||
* [ 1, 2, 3 ].each(&method(:puts)) #=> prints 1, 2, 3
|
||
*
|
||
* require 'date'
|
||
* %w[2017-03-01 2017-03-02].collect(&Date.method(:parse))
|
||
* #=> [#<Date: 2017-03-01 ((2457814j,0s,0n),+0s,2299161j)>, #<Date: 2017-03-02 ((2457815j,0s,0n),+0s,2299161j)>]
|
||
*/
|
||
/*
|
||
... | ... | |
* meth.receiver -> object
|
||
*
|
||
* Returns the bound receiver of the method object.
|
||
*
|
||
* (1..3).method(:map).receiver # => 1..3
|
||
*/
|
||
static VALUE
|
||
... | ... | |
* meth.owner -> class_or_module
|
||
*
|
||
* Returns the class or module that defines the method.
|
||
* See also receiver.
|
||
*
|
||
* (1..3).method(:map).owner #=> Enumerable
|
||
*/
|
||
static VALUE
|
||
... | ... | |
* l = Demo.new('Fred')
|
||
* m = l.method("hello")
|
||
* m.call #=> "Hello, @iv = Fred"
|
||
*
|
||
* Note that <code>Method</code> implements <code>to_proc</code> method,
|
||
* which means it can be used with iterators.
|
||
*
|
||
* [ 1, 2, 3 ].each(&method(:puts)) # => prints 3 lines to stdout
|
||
*
|
||
* out = File.open('test.txt', 'w')
|
||
* [ 1, 2, 3 ].each(&out.method(:puts)) # => prints 3 lines to file
|
||
*
|
||
* require 'date'
|
||
* %w[2017-03-01 2017-03-02].collect(&Date.method(:parse))
|
||
* #=> [#<Date: 2017-03-01 ((2457814j,0s,0n),+0s,2299161j)>, #<Date: 2017-03-02 ((2457815j,0s,0n),+0s,2299161j)>]
|
||
*/
|
||
VALUE
|
||
... | ... | |
return clone;
|
||
}
|
||
/* Document-method: Method#===
|
||
*
|
||
* call-seq:
|
||
* method === obj -> result_of_method
|
||
*
|
||
* Invokes the method with +obj+ as the parameter like #call. It
|
||
* is to allow a method object to be a target of +when+ clause in a case
|
||
* statement.
|
||
*
|
||
* require 'prime'
|
||
*
|
||
* case 1373
|
||
* when Prime.method(:prime?)
|
||
* # ....
|
||
* end
|
||
*/
|
||
/*
|
||
* call-seq:
|
||
* meth.call(args, ...) -> obj
|
||
... | ... | |
* meth.to_s -> string
|
||
* meth.inspect -> string
|
||
*
|
||
* Returns the name of the underlying method.
|
||
* Returns a human-readable description of the underlying method.
|
||
*
|
||
* "cat".method(:count).inspect #=> "#<Method: String#count>"
|
||
* (1..3).method(:map).inspect #=> "#<Method: Range(Enumerable)#map>"
|
||
*
|
||
* In the latter case, method description includes the "owner" of original
|
||
* method (+Enumerable+ module, which is included into +Range+).
|
||
*/
|
||
static VALUE
|