Waits until IO
is readable without blocking and returns self
, or nil
when times out. Returns true
immediately when buffered data is available.
Waits until IO
is writable without blocking and returns self
or nil
when times out.
Passes the Integer
ordinal of each character in ios, passing the codepoint as an argument. The stream must be opened for reading or an IOError
will be raised.
If no block is given, an enumerator is returned instead.
Deletes every key-value pair from gdbm for which block evaluates to true.
Provides marshalling support for use by the Marshal
library.
Removes the named field from the object. Returns the value that the field contained if it was defined.
require "ostruct" person = OpenStruct.new(name: "John", age: 70, pension: 300) person.delete_field("age") # => 70 person # => #<OpenStruct name="John", pension=300>
Setting the value to nil
will not remove the attribute:
person.pension = nil person # => #<OpenStruct name="John", pension=nil>
Deletes every element of the set for which block evaluates to true, and returns self. Returns an enumerator if no block is given.
Iterates over each component of the path.
Pathname.new("/usr/bin/ruby").each_filename {|filename| ... } # yields "usr", "bin", and "ruby".
Returns an Enumerator
if no block was given.
enum = Pathname.new("/usr/bin/ruby").each_filename # ... do stuff ... enum.each { |e| ... } # yields "usr", "bin", and "ruby".
This method is called when the parser found syntax error.
Iterates over the key-value pairs in the database, deleting those for which the block returns true
.
Returns an Addrinfo
object for remote address obtained by getpeername.
Note that addrinfo.protocol is filled by 0.
TCPSocket.open("www.ruby-lang.org", 80) {|s| p s.remote_address #=> #<Addrinfo: 221.186.184.68:80 TCP> } TCPServer.open("127.0.0.1", 1728) {|serv| c = TCPSocket.new("127.0.0.1", 1728) s = serv.accept p s.remote_address #=> #<Addrinfo: 127.0.0.1:36504 TCP> }
Invokes Release method of Dispatch interface of WIN32OLE
object. You should not use this method because this method exists only for debugging WIN32OLE
. The return value is reference counter of OLE object.
invokes Release method of Dispatch interface of WIN32OLE
object. Usually, you do not need to call this method because Release method called automatically when WIN32OLE
object garbaged.
Calls WIN32OLE#invoke
method.
Returns WIN32OLE_TYPE
object.
excel = WIN32OLE.new('Excel.Application') tobj = excel.ole_type
Returns the WIN32OLE_TYPELIB
object. The object represents the type library which contains the WIN32OLE
object.
excel = WIN32OLE.new('Excel.Application') tlib = excel.ole_typelib puts tlib.name # -> 'Microsoft Excel 9.0 Object Library'
Returns OLE type of WIN32OLE_PARAM
object(parameter of OLE method).
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') method = WIN32OLE_METHOD.new(tobj, 'SaveAs') param1 = method.params[0] puts param1.ole_type # => VARIANT
Returns value specified by the member name of VT_RECORD OLE variable. Or sets value specified by the member name of VT_RECORD OLE variable. If the member name is not correct, KeyError
exception is raised.
If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices Public Class ComClass Public Structure Book <MarshalAs(UnmanagedType.BStr)> _ Public title As String Public cost As Integer End Structure End Class
Then getting/setting value from Ruby is as the following:
obj = WIN32OLE.new('ComServer.ComClass') book = WIN32OLE_RECORD.new('Book', obj) book.title # => nil ( book.method_missing(:title) is invoked. ) book.title = "Ruby" # ( book.method_missing(:title=, "Ruby") is invoked. )
Returns array of WIN32OLE_TYPE
objects defined by the typelib type library. This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib)
.ole_classes instead.