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.
Returns a copy of self
with the given start
value:
d0 = Date.new(2000, 2, 3) d0.julian? # => false d1 = d0.new_start(Date::JULIAN) d1.julian? # => true
See argument start.
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 ...>
Creates a new MonitorMixin::ConditionVariable
associated with the Monitor
object.
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
Generates a new enumerator object that generates a Cartesian product of given enumerable objects.
e = Enumerator::Product.new(1..3, [4, 5]) e.to_a #=> [[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5]] e.size #=> 6
Create a new SHA2
hash object with a given bit length.
Valid bit lengths are 256, 384 and 512.
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
name
is the name of the function
need_gvl
is whether GVL is needed to call 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
.
Create a new handler with the open handlers
Used internally by Fiddle::Importer.dlload
Wraps the C pointer addr
as a C struct with the given types
.
When the instance is garbage collected, the C function func
is called.
See also Fiddle::Pointer.new