This string is put at the end of a line that holds a JSON
array.
This string is put at the end of a line that holds a JSON
array.
Duplicates self and resets its day of calendar reform.
d = Date.new(1582,10,15) d.new_start(Date::JULIAN) #=> #<Date: 1582-10-05 ...>
Returns OLE event object. The first argument specifies WIN32OLE
object. The second argument specifies OLE event name.
ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
Returns a new WIN32OLE_METHOD
object which represents the information about OLE method. The first argument ole_type specifies WIN32OLE_TYPE
object. The second argument method specifies OLE method name defined OLE class which represents WIN32OLE_TYPE
object.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
Returns WIN32OLE_PARAM
object which represents OLE parameter information. 1st argument should be WIN32OLE_METHOD
object. 2nd argument ‘n’ is n-th parameter of the method specified by 1st argument.
tobj = WIN32OLE_TYPE.new('Microsoft Scripting Runtime', 'IFileSystem') method = WIN32OLE_METHOD.new(tobj, 'CreateTextFile') param = WIN32OLE_PARAM.new(method, 2) # => #<WIN32OLE_PARAM:Overwrite=true>
Returns WIN32OLE_RECORD
object. The first argument is struct name (String
or Symbol
). The second parameter obj should be WIN32OLE
object or WIN32OLE_TYPELIB
object. If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices Public Class ComClass Public Structure Book <MarshalAs(UnmanagedType.BStr)> _ Public title As String Public cost As Integer End Structure End Class
then, you can create WIN32OLE_RECORD
object is as following:
require 'win32ole' obj = WIN32OLE.new('ComServer.ComClass') book1 = WIN32OLE_RECORD.new('Book', obj) # => WIN32OLE_RECORD object tlib = obj.ole_typelib book2 = WIN32OLE_RECORD.new('Book', tlib) # => WIN32OLE_RECORD object
Returns a new WIN32OLE_TYPE
object. The first argument typelib specifies OLE type library name. The second argument specifies OLE class name.
WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') # => WIN32OLE_TYPE object of Application class of Excel.
Returns a new WIN32OLE_TYPELIB
object.
The first argument typelib specifies OLE type library name or GUID or OLE library file. The second argument is major version or version of the type library. The third argument is minor version. The second argument and third argument are optional. If the first argument is type library name, then the second and third argument are ignored.
tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}') tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3) tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3) tlib5 = WIN32OLE_TYPELIB.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL") puts tlib1.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib2.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib3.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib4.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib5.name # -> 'Microsoft Shell Controls And Automation'
Returns Ruby object wrapping OLE variant. The first argument specifies Ruby object to convert OLE variant variable. The second argument specifies VARIANT type. In some situation, you need the WIN32OLE_VARIANT
object to pass OLE method
shell = WIN32OLE.new("Shell.Application") folder = shell.NameSpace("C:\\Windows") item = folder.ParseName("tmp.txt") # You can't use Ruby String object to call FolderItem.InvokeVerb. # Instead, you have to use WIN32OLE_VARIANT object to call the method. shortcut = WIN32OLE_VARIANT.new("Create Shortcut(\&S)") item.invokeVerb(shortcut)
Duplicates self and resets its offset.
d = DateTime.new(2001,2,3,4,5,6,'-02:00') #=> #<DateTime: 2001-02-03T04:05:06-02:00 ...> d.new_offset('+09:00') #=> #<DateTime: 2001-02-03T15:05:06+09:00 ...>
Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.
Creates a new ipaddr containing the given network byte ordered string form of an IP address.
Returns an arbitrary seed value. This is used by Random.new
when no seed value is specified as an argument.
Random.new_seed #=> 115032730400174366788466674494640623225
Creates a new MonitorMixin::ConditionVariable
associated with the Monitor
object.
Creates a new Lazy
enumerator. When the enumerator is actually enumerated (e.g. by calling force
), obj
will be enumerated and each value passed to the given block. The block can yield values back using yielder
. For example, to create a “filter+map” enumerator:
def filter_map(sequence) Lazy.new(sequence) do |yielder, *values| result = yield *values yielder << result if result end end filter_map(1..Float::INFINITY) {|i| i*i if i.even?}.first(5) #=> [4, 16, 36, 64, 100]
Generates a new enumerator object that iterates over the elements of given enumerable objects in sequence.
e = Enumerator::Chain.new(1..3, [4, 5]) e.to_a #=> [1, 2, 3, 4, 5] e.size #=> 5
Construct a new Closure
object.
ret
is the C type to be returned
args
is an Array
of arguments, passed to the callback function
abi
is the abi of the closure
If there is an error in preparing the ffi_cif or ffi_prep_closure, then a RuntimeError
will be raised.
Constructs a Function
object.
ptr
is a referenced function, of a Fiddle::Handle
args
is an Array
of arguments, passed to the ptr
function
ret_type
is the return type of the function
abi
is the ABI of the function
Create a new handler that opens library
with flags
.
If no library
is specified or nil
is given, DEFAULT
is used, which is the equivalent to RTLD_DEFAULT. See man 3 dlopen
for more.
lib = Fiddle::Handle.new
The default is dependent on OS, and provide a handle for all libraries already loaded. For example, in most cases you can use this to access libc
functions, or ruby functions like rb_str_new
.