Deletes every key-value pair from gdbm for which block evaluates to true.
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.
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.
returns type of OLE class.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') puts tobj.ole_type # => Class
Returns the WIN32OLE_TYPELIB
object which is including the WIN32OLE_TYPE
object. If it is not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library'
Returns the type library file path.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...]
Returns the type library file path.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...]
Returns OLE type string.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.ole_type} #{variable.name}" end The result of above script is following: INT xlChart INT xlDialogSheet INT xlExcel4IntlMacroSheet INT xlExcel4MacroSheet INT xlWorksheet