Write value to a registry value named name.
The value type is REG_SZ(write_s
), REG_DWORD(write_i
), or REG_BINARY(write_bin
).
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 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
Returns original filename recorded in the gzip file header, or nil
if original filename is not present.
Specify the original name (str
) in the gzip header.
Returns true
if stat is writable by the real user id of this process.
File.stat("testfile").writable_real? #=> true
If stat is writable by others, returns an integer representing the file permission bits of stat. Returns nil
otherwise. The meaning of the bits is platform dependent; on Unix systems, see stat(2)
.
m = File.stat("/tmp").world_writable? #=> 511 sprintf("%o", m) #=> "777"
Read a chunk or all of the buffer into a string, in the specified encoding
. If no encoding is provided Encoding::BINARY
is used.
buffer = IO::Buffer.for('test') buffer.get_string # => "test" buffer.get_string(2) # => "st" buffer.get_string(2, 1) # => "s"
Efficiently copy from a source String
into the buffer, at offset
using memcpy
.
buf = IO::Buffer.new(8) # => # #<IO::Buffer 0x0000557412714a20+8 INTERNAL> # 0x00000000 00 00 00 00 00 00 00 00 ........ # set buffer starting from offset 1, take 2 bytes starting from string's # second buf.set_string('test', 1, 2, 1) # => 2 buf # => # #<IO::Buffer 0x0000557412714a20+8 INTERNAL> # 0x00000000 00 65 73 00 00 00 00 00 .es.....
See also copy
for examples of how buffer writing might be used for changing associated strings and files.
Takes source
, which can be a string of Ruby code, or an open File
object. that contains Ruby source code. It parses and compiles using prism.
Optionally takes file
, path
, and line
which describe the file path, real path and first line number of the ruby code in source
which are metadata attached to the returned iseq
.
file
is used for ‘__FILE__` and exception backtrace. path
is used for require_relative
base. It is recommended these should be the same full path.
options
, which can be true
, false
or a Hash
, is used to modify the default behavior of the Ruby iseq compiler.
For details regarding valid compile options see ::compile_option=
.
RubyVM::InstructionSequence.compile("a = 1 + 2") #=> <RubyVM::InstructionSequence:<compiled>@<compiled>> path = "test.rb" RubyVM::InstructionSequence.compile(File.read(path), path, File.expand_path(path)) #=> <RubyVM::InstructionSequence:<compiled>@test.rb:1> file = File.open("test.rb") RubyVM::InstructionSequence.compile(file) #=> <RubyVM::InstructionSequence:<compiled>@<compiled>:1> path = File.expand_path("test.rb") RubyVM::InstructionSequence.compile(File.read(path), path, path) #=> <RubyVM::InstructionSequence:<compiled>@/absolute/path/to/test.rb:1>
It returns recorded script lines if it is available. The script lines are not limited to the iseq range, but are entire lines of the source file.
Note that this is an API for ruby internal use, debugging, and research. Do not use this for any other purpose. The compatibility is not guaranteed.
Take a location from the prism parser and set the necessary instance variables.
Like Net::HTTP.get
, but writes the returned body to $stdout; returns nil
.
Sets the maximum number of times to retry an idempotent request in case of Net::ReadTimeout, IOError
, EOFError
, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError
, Timeout::Error
. The initial value is 1.
Argument retries
must be a non-negative numeric value:
http = Net::HTTP.new(hostname) http.max_retries = 2 # => 2 http.max_retries # => 2
Sets the write timeout, in seconds, for self
to integer sec
; the initial value is 60.
Argument sec
must be a non-negative numeric value:
_uri = uri.dup _uri.path = '/posts' body = 'bar' * 200000 data = <<EOF {"title": "foo", "body": "#{body}", "userId": "1"} EOF headers = {'content-type': 'application/json'} http = Net::HTTP.new(hostname) http.write_timeout # => 60 http.post(_uri.path, data, headers) # => #<Net::HTTPCreated 201 Created readbody=true> http.write_timeout = 0 http.post(_uri.path, data, headers) # Raises Net::WriteTimeout.
Returns all of the lines of the source code associated with this location.
Implement the pretty print interface for Location
.
Implement the pretty print interface for Token
.