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
Returns variable kind string.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.variable_kind}" end The result of above script is following: xlChart CONSTANT xlDialogSheet CONSTANT xlExcel4IntlMacroSheet CONSTANT xlExcel4MacroSheet CONSTANT xlWorksheet CONSTANT
Invoked by Ruby when obj is sent a message it cannot handle. symbol is the symbol for the method called, and args are any arguments that were passed to it. By default, the interpreter raises an error when this method is called. However, it is possible to override the method to provide more dynamic behavior. If it is decided that a particular method should not be handled, then super should be called, so that ancestors can pick up the missing method. The example below creates a class Roman
, which responds to methods with names consisting of roman numerals, returning the corresponding integer values.
class Roman def roman_to_int(str) # ... end def method_missing(symbol, *args) str = symbol.id2name begin roman_to_int(str) rescue super(symbol, *args) end end end r = Roman.new r.iv #=> 4 r.xxiii #=> 23 r.mm #=> 2000 r.foo #=> NoMethodError
If Hash::new
was invoked with a block, return that block, otherwise return nil
.
h = Hash.new {|h,k| h[k] = k*k } #=> {} p = h.default_proc #=> #<Proc:0x401b3d08@-:1> a = [] #=> [] p.call(a, 2) a #=> [nil, nil, 4]
Sets the default proc to be executed on each failed key lookup.
h.default_proc = proc do |hash, key| hash[key] = key + key end h[2] #=> 4 h["cat"] #=> "catcat"
Deletes every key-value pair from hsh for which block evaluates to true
.
If no block is given, an enumerator is returned instead.
h = { "a" => 100, "b" => 200, "c" => 300 } h.delete_if {|key, value| key >= "b" } #=> {"a"=>100}
Deletes every environment variable for which the block evaluates to true
.
If no block is given an enumerator is returned instead.
Iterates over each codepoint of each file in ARGF
.
This method allows you to treat the files supplied on the command line as a single file consisting of the concatenation of each named file. After the last codepoint of the first file has been returned, the first codepoint of the second file is returned. The ARGF.filename
method can be used to determine the name of the file in which the current codepoint appears.
If no block is given, an enumerator is returned instead.
Synonym for ENV
.
Returns the methods available to this delegate object as the union of this object’s and _getobj_ public methods.
Serialization support for the object returned by _getobj_.
Creates a new compiler for ERB
. See ERB::Compiler.new for details
Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.
Define methodname as instance method of mod from compiled Ruby source.
example:
filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml erb = ERB.new(File.read(filename)) erb.def_method(MyClass, 'render(arg1, arg2)', filename) print MyClass.new.render('foo', 123)
Returns the names of the binding’s local variables as symbols.
def foo a = 1 2.times do |n| binding.local_variables #=> [:a, :n] end end
This method is the short version of the following code:
binding.eval("local_variables")
Returns true
if this is a lower triangular matrix.
Returns true
if this is an upper triangular matrix.