hash

meth.hash â integer Instance Public methods Returns a hash value corresponding to the method object.

eql?

meth == other_meth â true or false Instance Public methods Two method objects are equal if they are bound to the same object and refer to the same method definition and their owners are the same class or module.

clone

method.clone â new_method Instance Public methods Returns a clone of this method. class A def foo return "bar" end end m = A.new.method(:foo) m.call # => "bar" n = m.clone.call # => "bar"

bind

umeth.bind(obj) â method Instance Public methods 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 puts "In test, class = #{self.class}" end end class B < A end class C < B end um = B.instance_method(:test) bm = um.bind(C.new) bm.call bm = um.bind(B.new) bm.call bm = um.bind(A.new) bm.call produces: In test, class = C In test, class = B prog.rb:16:in `bind': bind argument must be an instance

arity

meth.arity â fixnum Instance Public methods Returns an indication of the number of arguments accepted by a method. Returns a nonnegative integer for methods that take a fixed number of arguments. For Ruby methods that take a variable number of arguments, returns -n-1, where n is the number of required arguments. For methods written in C, returns -1 if the call takes a variable number of arguments. class C def one; end def two(a); end def three(*a); end def four(a, b

==

meth == other_meth â true or false Instance Public methods Two method objects are equal if they are bound to the same object and refer to the same method definition and their owners are the same class or module.

send

udpsocket.send(mesg, flags, host, port) => numbytes_sentudpsocket.send(mesg, flags, sockaddr_to) => numbytes_sentudpsocket.send(mesg, flags) => numbytes_sent Instance Public methods Sends mesg via udpsocket. flags should be a bitwise OR of Socket::MSG_* constants. u1 = UDPSocket.new u1.bind("127.0.0.1", 4913) u2 = UDPSocket.new u2.send "hi", 0, "127.0.0.1", 4913 mesg, addr = u1.recvfrom(10) u1.send mesg, 0, addr[3], addr[1] p u2.recv(100) #=> "hi"

recvfrom_nonblock

udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr] Instance Public methods Receives up to maxlen bytes from udpsocket using recvfrom(2) after O_NONBLOCK is set for the underlying file descriptor. If maxlen is omitted, its default value is 65536. flags is zero or more of the MSG_ options. The first element of the results, mesg, is the data received. The second element, sender_inet_addr, is an a

connect

udpsocket.connect(host, port) => 0 Instance Public methods Connects udpsocket to host:port. This makes possible to send without destination address. u1 = UDPSocket.new u1.bind("127.0.0.1", 4913) u2 = UDPSocket.new u2.connect("127.0.0.1", 4913) u2.send "uuuu", 0 p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", "127.0.0.1"]]

bind

udpsocket.bind(host, port) #=> 0 Instance Public methods Binds udpsocket to host:port. u1 = UDPSocket.new u1.bind("127.0.0.1", 4913) u1.send "message-to-self", 0, "127.0.0.1", 4913 p u1.recvfrom(10) #=> ["message-to", ["AF_INET", 4913, "localhost", "127.0.0.1"]]