Results for: "module_function"

The file name of the input.

returns the cmsg level as an integer.

p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "").level
#=> 41
No documentation available

returns the socket level as an integer.

p Socket::Option.new(:INET6, :IPV6, :RECVPKTINFO, [1].pack("i!")).level
#=> 41

marshalling is not allowed

No documentation available

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 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 true if the method is public.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.visible? # => true

Returns help file. If help file is not found, then the method returns nil.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.helpfile # => C:\...\VBAXL9.CHM

Returns default value. If the default value does not exist, this method returns nil.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
method.params.each do |param|
  if param.default
    puts "#{param.name} (= #{param.default})"
  else
    puts "#{param}"
  end
end

The above script result is following:

Filename
FileFormat
Password
WriteResPassword
ReadOnlyRecommended
CreateBackup
AccessMode (= 1)
ConflictResolution
AddToMru
TextCodepage
TextVisualLayout

Returns true if the OLE class is public.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.visible  # => true

Returns helpfile path. If helpfile is not found, then returns nil.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.helpfile # => C:\...\VBAXL9.CHM

Returns array of WIN32OLE::Variable objects which represent variables defined in OLE class.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
vars = tobj.variables
vars.each do |v|
  puts "#{v.name} = #{v.value}"
end

The result of above sample script is follows:
  xlChart = -4109
  xlDialogSheet = -4116
  xlExcel4IntlMacroSheet = 4
  xlExcel4MacroSheet = 3
  xlWorksheet = -4167

Returns true if the type library information is not hidden. If wLibFlags of TLIBATTR is 0 or LIBFLAG_FRESTRICTED or LIBFLAG_FHIDDEN, the method returns false, otherwise, returns true. If the method fails to access the TLIBATTR information, then WIN32OLE::RuntimeError is raised.

tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library')
tlib.visible? # => true

Returns true if the variable is public.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
  puts "#{variable.name} #{variable.visible?}"
end

The result of above script is following:
  xlChart true
  xlDialogSheet true
  xlExcel4IntlMacroSheet true
  xlExcel4MacroSheet true
  xlWorksheet true

Returns the adler-32 checksum.

Returns compression level.

Returns true if stat is readable by the effective user id of this process.

File.stat("testfile").readable?   #=> true

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 true if stat is a regular file (not a device file, pipe, socket, etc.).

File.stat("testfile").file?   #=> true

Returns a human-readable string representation of the buffer. The exact format is subject to change.

buffer = IO::Buffer.for("Hello World")
puts buffer.hexdump
# 0x00000000  48 65 6c 6c 6f 20 57 6f 72 6c 64                Hello World

As buffers are usually fairly big, you may want to limit the output by specifying the offset and length:

puts buffer.hexdump(6, 5)
# 0x00000006  57 6f 72 6c 64                                  World

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

Fill buffer with value, starting with offset and going for length bytes.

buffer = IO::Buffer.for('test')
# =>
#   <IO::Buffer 0x00007fca40087c38+4 SLICE>
#   0x00000000  74 65 73 74         test

buffer.clear
# =>
#   <IO::Buffer 0x00007fca40087c38+4 SLICE>
#   0x00000000  00 00 00 00         ....

buf.clear(1) # fill with 1
# =>
#   <IO::Buffer 0x00007fca40087c38+4 SLICE>
#   0x00000000  01 01 01 01         ....

buffer.clear(2, 1, 2) # fill with 2, starting from offset 1, for 2 bytes
# =>
#   <IO::Buffer 0x00007fca40087c38+4 SLICE>
#   0x00000000  01 02 02 01         ....

buffer.clear(2, 1) # fill with 2, starting from offset 1
# =>
#   <IO::Buffer 0x00007fca40087c38+4 SLICE>
#   0x00000000  01 02 02 02         ....
Search took: 5ms  ·  Total Results: 5313