creates a socket connected to the address of self.
The optional argument opts is options represented by a hash. opts may have following options:
specify the timeout in seconds.
If a block is given, it is called with the socket and the value of the block is returned. The socket is returned otherwise.
Addrinfo.tcp("www.ruby-lang.org", 80).connect {|s| s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n" puts s.read }
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"]]
Truncates the buffer string to at most integer bytes. The stream must be opened for writing.
Appends str
to the string being scanned. This method does not affect scan pointer.
s = StringScanner.new("Fri Dec 12 1975 14:39") s.scan(/Fri /) s << " +1000 GMT" s.string # -> "Fri Dec 12 1975 14:39 +1000 GMT" s.scan(/Dec/) # -> "Dec"
Returns running OLE Automation object or WIN32OLE
object from moniker. 1st argument should be OLE program id or class id or moniker.
WIN32OLE.connect('Excel.Application') # => WIN32OLE object which represents running Excel.
Returns the type library version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.version #-> "1.3"
Returns revision information for the erb.rb module.
Version
Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Mutex
.
Task
description for the clobber rdoc task or its renamed equivalent
Task
description for the rdoc task or its renamed equivalent
Task
description for the rerdoc task or its renamed description
Establishes proc on thr as the handler for tracing, or disables tracing if the parameter is nil
.
Adds proc as a handler for tracing.
Establishes proc as the handler for tracing, or disables tracing if the parameter is nil
.
Note: this method is obsolete, please use TracePoint
instead.
proc takes up to six parameters:
an event name
a filename
a line number
an object id
a binding
the name of a class
proc is invoked whenever an event occurs.
Events are:
c-call
call a C-language routine
c-return
return from a C-language routine
call
call a Ruby method
class
start a class or module definition
end
finish a class or module definition
line
execute code on a new line
raise
raise an exception
return
return from a Ruby method
Tracing is disabled within the context of proc.
class Test def test a = 1 b = 2 end end set_trace_func proc { |event, file, line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname } t = Test.new t.test line prog.rb:11 false c-call prog.rb:11 new Class c-call prog.rb:11 initialize Object c-return prog.rb:11 initialize Object c-return prog.rb:11 new Class line prog.rb:12 false call prog.rb:2 test Test line prog.rb:3 test Test line prog.rb:4 test Test return prog.rb:4 test Test
Returns the class for the given object
.
class A def foo ObjectSpace::trace_object_allocations do obj = Object.new p "#{ObjectSpace::allocation_class_path(obj)}" end end end A.new.foo #=> "Class"
See ::trace_object_allocations
for more information and examples.
UNTESTED
Content: [ String
text ]