Sends the String
msg
to the source
returns the socket family as an integer.
p Socket::Option.new(:INET6, :IPV6, :RECVPKTINFO, [1].pack("i!")).family #=> 10
returns the socket option data as a string.
p Socket::Option.new(:INET6, :IPV6, :RECVPKTINFO, [1].pack("i!")).data #=> "\x01\x00\x00\x00"
return values as an array
Returns true if argument is optional.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') method = WIN32OLE::Method.new(tobj, 'SaveAs') param1 = method.params[0] puts "#{param1.name} #{param1.optional?}" # => Filename true
Returns true if argument is return value.
tobj = WIN32OLE::Type.new('DirectX 7 for Visual Basic Type Library', 'DirectPlayLobbyConnection') method = WIN32OLE::Method.new(tobj, 'GetPlayerShortName') param = method.params[0] puts "#{param.name} #{param.retval?}" # => name true
Returns value if value is exists. If the value does not exist, this method returns nil.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.value}" end The result of above script is following: xlChart = -4109 xlDialogSheet = -4116 xlExcel4IntlMacroSheet = 4 xlExcel4MacroSheet = 3 xlWorksheet = -4167
Returns Ruby object value from OLE variant.
obj = WIN32OLE::Variant.new(1, WIN32OLE::VARIANT::VT_BSTR) obj.value # => "1" (not Integer object, but String object "1")
Sets variant value to val. If the val type does not match variant value type(vartype), then val is changed to match variant value type(vartype) before setting val. This method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY). If the vartype is VT_UI1|VT_ARRAY, the val should be String
object.
obj = WIN32OLE::Variant.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4 obj.value = 3.2 # 3.2 is changed to 3 when setting value. p obj.value # => 3
Total number of input bytes read so far.
Total number of output bytes output so far.
Reads at most maxlen bytes from the gzipped stream but it blocks only if gzipreader has no data immediately available. If the optional outbuf argument is present, it must reference a String
, which will receive the data. It raises EOFError
on end of file.
Returns true
if stat is writable by the effective user id of this process.
File.stat("testfile").writable? #=> true
Returns true
if stat is executable or if the operating system doesn’t distinguish executable files from nonexecutable files. The tests are made using the effective owner of the process.
File.stat("testfile").executable? #=> false
Returns whether the buffer buffer is accessible.
A buffer becomes invalid if it is a slice of another buffer (or string) which has been freed or re-allocated at a different address.
If the buffer was freed with free
, transferred with transfer
, or was never allocated in the first place.
buffer = IO::Buffer.new(0) buffer.null? #=> true buffer = IO::Buffer.new(4) buffer.null? #=> false buffer.free buffer.null? #=> true
The buffer is external if it references the memory which is not allocated or mapped by the buffer itself.
A buffer created using ::for
has an external reference to the string’s memory.
External buffer can’t be resized.
If the buffer is internal, meaning it references memory allocated by the buffer itself.
An internal buffer is not associated with any external memory (e.g. string) or file mapping.
Internal buffers are created using ::new
and is the default when the requested size is less than the IO::Buffer::PAGE_SIZE
and it was not requested to be mapped on creation.
Internal buffers can be resized, and such an operation will typically invalidate all slices, but not always.
If the buffer is read only, meaning the buffer cannot be modified using set_value
, set_string
or copy
and similar.
Frozen strings and read-only files create read-only buffers.
Returns an array of values of buffer_type
starting from offset
.
If count
is given, only count
values will be returned.
IO::Buffer.for("Hello World").values(:U8, 2, 2) # => [108, 108]
Evaluates the instruction sequence and returns the result.
RubyVM::InstructionSequence.compile("1 + 2").eval #=> 3
Returns the value or list of values for this cookie.
Replaces the value of this cookie with a new value or list of values.