Sets property of OLE object. When you want to set property with argument, you can use this method.
excel = WIN32OLE.new('Excel.Application') excel.Visible = true book = excel.workbooks.add sheet = book.worksheets(1) sheet.setproperty('Cells', 1, 2, 10) # => The B1 cell value is 10.
sets event handler object. If handler object has onXXX method according to XXX event, then onXXX method is called when XXX event occurs.
If handler object has method_missing and there is no method according to the event, then method_missing called and 1-st argument is event name.
If handler object has onXXX method and there is block defined by WIN32OLE_EVENT#on_event
(‘XXX’){}, then block is executed but handler object method is not called when XXX event occurs.
class Handler def onStatusTextChange(text) puts "StatusTextChanged" end def onPropertyChange(prop) puts "PropertyChanged" end def method_missing(ev, *arg) puts "other event #{ev}" end end handler = Handler.new ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE_EVENT.new(ie) ev.on_event("StatusTextChange") {|*args| puts "this block executed." puts "handler.onStatusTextChange method is not called." } ev.handler = handler
returns handler object.
Returns array of ProgID.
Returns ProgID if it exists. If not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') puts tobj.progid # => Excel.Application.9
Returns the type library version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.version #-> "1.3"
Returns a new hash created by using hsh’s values as keys, and the keys as values. If a key with the same value already exists in the hsh, then the last one defined will be used, the earlier value(s) will be discarded.
h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 } h.invert #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"}
If there is no key with the same value, Hash#invert
is involutive.
h = { a: 1, b: 3, c: 4 } h.invert.invert == h #=> true
The condition, no key with the same value, can be tested by comparing the size of inverted hash.
# no key with the same value h = { a: 1, b: 3, c: 4 } h.size == h.invert.size #=> true # two (or more) keys has the same value h = { a: 1, b: 3, c: 1 } h.size == h.invert.size #=> false
Returns true
if the given key is present in hsh.
h = { "a" => 100, "b" => 200 } h.has_key?("a") #=> true h.has_key?("z") #=> false
Note that include?
and member?
do not test member equality using ==
as do other Enumerables.
See also Enumerable#include?
Returns a new hash created by using environment variable names as values and values as names.
Returns true
if there is an environment variable with the given name
.
Returns the next line from the current file in ARGF
.
By default lines are assumed to be separated by $/
; to use a different character as a separator, supply it as a String
for the sep argument.
The optional limit argument specifies how many characters of each line to return. By default all characters are returned.
See IO.readlines
for details about getline_args.
Reads the next character from ARGF
and returns it as a String
. Returns nil
at the end of the stream.
ARGF
treats the files named on the command line as a single file created by concatenating their contents. After returning the last character of the first file, it returns the first character of the second file, and so on.
For example:
$ echo "foo" > file $ ruby argf.rb file ARGF.getc #=> "f" ARGF.getc #=> "o" ARGF.getc #=> "o" ARGF.getc #=> "\n" ARGF.getc #=> nil ARGF.getc #=> nil
Gets the next 8-bit byte (0..255) from ARGF
. Returns nil
if called at the end of the stream.
For example:
$ echo "foo" > file $ ruby argf.rb file ARGF.getbyte #=> 102 ARGF.getbyte #=> 111 ARGF.getbyte #=> 111 ARGF.getbyte #=> 10 ARGF.getbyte #=> nil
Closes the current file and skips to the next file in ARGV. If there are no more files to open, just closes the current file. STDIN
will not be closed.
For example:
$ ruby argf.rb foo bar ARGF.filename #=> "foo" ARGF.close ARGF.filename #=> "bar" ARGF.close
Returns true if the current file has been closed; false otherwise. Use ARGF.close
to actually close the current file.
This method is an alias for http_header
, when HTML5
tag maker is inactive.
NOTE: use http_header
to create HTTP header blocks, this alias is only provided for backwards compatibility.
Using header
with the HTML5
tag maker will create a <header> element.
This method is a convenience for building Unix-like filters for CSV
data. Each row is yielded to the provided block which can alter it as needed. After the block returns, the row is appended to output
altered or not.
The input
and output
arguments can be anything CSV::new()
accepts (generally String or IO
objects). If not given, they default to ARGF
and $stdout
.
The options
parameter is also filtered down to CSV::new()
after some clever key parsing. Any key beginning with :in_
or :input_
will have that leading identifier stripped and will only be used in the options
Hash
for the input
object. Keys starting with :out_
or :output_
affect only output
. All other keys are assigned to both objects.
The :output_row_sep
option
defaults to $INPUT_RECORD_SEPARATOR
($/
).
Returns nil
if headers will not be used, true
if they will but have not yet been read, or the actual headers after they have been read. See CSV::new
for details.
You can use this method to install a CSV::Converters
built-in, or provide a block that handles a custom conversion.
If you provide a block that takes one argument, it will be passed the field and is expected to return the converted value or the field itself. If your block takes two arguments, it will also be passed a CSV::FieldInfo
Struct
, containing details about the field. Again, the block should return a converted field or the field itself.
This method must be overridden by subclasses and should return the object method calls are being delegated to.
Returns the current object method calls are being delegated to.
Returns revision information for the erb.rb module.