Returns string of return value type of method.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') method = WIN32OLE_METHOD.new(tobj, 'Add') puts method.return_type # => Workbook
Returns number of return value type of method.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') method = WIN32OLE_METHOD.new(tobj, 'Add') puts method.return_vtype # => 26
Returns major version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') puts tobj.major_version # => 8
Returns minor version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') puts tobj.minor_version # => 2
Returns the type library major version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.major_version # -> 1
Returns the type library minor version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.minor_version # -> 3
Evaluates a string containing Ruby source code, or the given block, within the context of the receiver (obj). In order to set the context, the variable self
is set to obj while the code is executing, giving the code access to obj’s instance variables and private methods.
When instance_eval
is given a block, obj is also passed in as the block’s only argument.
When instance_eval
is given a String
, the optional second and third parameters supply a filename and starting line number that are used when reporting compilation errors.
class KlassWithSecret def initialize @secret = 99 end private def the_secret "Ssssh! The secret is #{@secret}." end end k = KlassWithSecret.new k.instance_eval { @secret } #=> 99 k.instance_eval { the_secret } #=> "Ssssh! The secret is 99." k.instance_eval {|obj| obj == self } #=> true
Executes the given block within the context of the receiver (obj). In order to set the context, the variable self
is set to obj while the code is executing, giving the code access to obj’s instance variables. Arguments are passed as block parameters.
class KlassWithSecret def initialize @secret = 99 end end k = KlassWithSecret.new k.instance_exec(5) {|x| @secret+x } #=> 104
Returns self
.
Returns a Proc
which maps keys to values.
h = {a:1, b:2} hp = h.to_proc hp.call(:a) #=> 1 hp.call(:b) #=> 2 hp.call(:c) #=> nil [:a, :b, :c].map(&h) #=> [1, 2, nil]
Returns a new hash with the results of running the block once for every key. This method does not change the values.
h = { a: 1, b: 2, c: 3 } h.transform_keys {|k| k.to_s } #=> { "a" => 1, "b" => 2, "c" => 3 } h.transform_keys(&:to_s) #=> { "a" => 1, "b" => 2, "c" => 3 } h.transform_keys.with_index {|k, i| "#{k}.#{i}" } #=> { "a.0" => 1, "b.1" => 2, "c.2" => 3 }
If no block is given, an enumerator is returned instead.
Invokes the given block once for each key in hsh, replacing it with the new key returned by the block, and then returns hsh. This method does not change the values.
h = { a: 1, b: 2, c: 3 } h.transform_keys! {|k| k.to_s } #=> { "a" => 1, "b" => 2, "c" => 3 } h.transform_keys!(&:to_sym) #=> { a: 1, b: 2, c: 3 } h.transform_keys!.with_index {|k, i| "#{k}.#{i}" } #=> { "a.0" => 1, "b.1" => 2, "c.2" => 3 }
If no block is given, an enumerator is returned instead.
Returns a new hash with the results of running the block once for every value. This method does not change the keys.
h = { a: 1, b: 2, c: 3 } h.transform_values {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 } h.transform_values(&:to_s) #=> { a: "1", b: "2", c: "3" } h.transform_values.with_index {|v, i| "#{v}.#{i}" } #=> { a: "1.0", b: "2.1", c: "3.2" }
If no block is given, an enumerator is returned instead.
Invokes the given block once for each value in hsh, replacing it with the new value returned by the block, and then returns hsh. This method does not change the keys.
h = { a: 1, b: 2, c: 3 } h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 } h.transform_values!(&:to_s) #=> { a: "2", b: "5", c: "10" } h.transform_values!.with_index {|v, i| "#{v}.#{i}" } #=> { a: "2.0", b: "5.1", c: "10.2" }
If no block is given, an enumerator is returned instead.
Creates a hash with a copy of the environment variables.
Returns an IO
object representing the current file. This will be a File
object unless the current file is a stream such as STDIN.
For example:
ARGF.to_io #=> #<File:glark.txt> ARGF.to_io #=> #<IO:<STDIN>>
Reads at most maxlen bytes from the ARGF
stream in non-blocking mode.
Returns true
if headers will be returned as a row of results. See CSV::new
for details.
Returns true
if all output fields are quoted. See CSV::new
for details.
Returns the list of break points where execution will be stopped.
See DEBUGGER__
for more usage
Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.