File: //usr/share/ri/3.0.0/system/Object/method-i.ri
U:RDoc::AnyMethod[iI"method:ETI"Object#method;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"HLooks up the named method as a receiver in <i>obj</i>, returning a ;TI"GMethod object (or raising NameError). The Method object acts as a ;TI"Hclosure in <i>obj</i>'s object instance, so instance variables and ;TI"5the value of <code>self</code> remain available.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"class Demo
;TI" def initialize(n)
;TI" @iv = n
;TI" end
;TI" def hello()
;TI" "Hello, @iv = #{@iv}"
;TI" end
;TI" end
;TI"
;TI"k = Demo.new(99)
;TI"m = k.method(:hello)
;TI"$m.call #=> "Hello, @iv = 99"
;TI"
;TI"l = Demo.new('Fred')
;TI"m = l.method("hello")
;TI"&m.call #=> "Hello, @iv = Fred"
;T:@format0o;
; [I"DNote that Method implements <code>to_proc</code> method, which ;TI")means it can be used with iterators.;T@o;; [
I"D[ 1, 2, 3 ].each(&method(:puts)) # => prints 3 lines to stdout
;TI"
;TI"&out = File.open('test.txt', 'w')
;TI"F[ 1, 2, 3 ].each(&out.method(:puts)) # => prints 3 lines to file
;TI"
;TI"require 'date'
;TI"=%w[2017-03-01 2017-03-02].collect(&Date.method(:parse))
;TI"s#=> [#<Date: 2017-03-01 ((2457814j,0s,0n),+0s,2299161j)>, #<Date: 2017-03-02 ((2457815j,0s,0n),+0s,2299161j)>];T;
0:
@fileI"proc.c;T:0@omit_headings_from_table_of_contents_below0I""obj.method(sym) -> method
;T0[ I" (p1);T@2FI"Object;TcRDoc::NormalClass00