Results for: "Data"

Returns true if the arguments define a valid ordinal date, false otherwise:

Date.valid_date?(2001, 2, 3)  # => true
Date.valid_date?(2001, 2, 29) # => false
Date.valid_date?(2001, 2, -1) # => true

See argument start.

Related: Date.jd, Date.new.

Returns self.

Returns a DateTime whose value is the same as self:

Date.new(2001, 2, 3).to_datetime # => #<DateTime: 2001-02-03T00:00:00+00:00>

Returns a Date object which denotes self.

Returns self.

Returns a Date object which denotes self.

Returns a DateTime object which denotes self.

Returns true if this class can be used to create an instance from a serialised JSON string. The class has to implement a class method json_create that expects a hash as first parameter. The hash should include the required data.

Returns the object for which the receiver is the singleton class.

Raises an TypeError if the class is not a singleton class.

class Foo; end

Foo.singleton_class.attached_object        #=> Foo
Foo.attached_object                        #=> TypeError: `Foo' is not a singleton class
Foo.new.singleton_class.attached_object    #=> #<Foo:0x000000010491a370>
TrueClass.attached_object                  #=> TypeError: `TrueClass' is not a singleton class
NilClass.attached_object                   #=> TypeError: `NilClass' is not a singleton class

Returns garbage collector generation for the given object.

class B
  include ObjectSpace

  def foo
    trace_object_allocations do
      obj = Object.new
      p "Generation is #{allocation_generation(obj)}"
    end
  end
end

B.new.foo #=> "Generation is 3"

See ::trace_object_allocations for more information and examples.

Returns information for heaps in the GC.

If the first optional argument, heap_name, is passed in and not nil, it returns a Hash containing information about the particular heap. Otherwise, it will return a Hash with heap names as keys and a Hash containing information about the heap as values.

If the second optional argument, hash_or_key, is given as Hash, it will be overwritten and returned. This is intended to avoid the probe effect.

If both optional arguments are passed in and the second optional argument is a symbol, it will return a Numeric of the value for the particular heap.

On CRuby, heap_name is of the type Integer but may be of type String on other implementations.

The contents of the hash are implementation specific and may change in the future without notice.

If the optional argument, hash, is given, it is overwritten and returned.

This method is only expected to work on CRuby.

The hash includes the following keys about the internal information in the GC:

slot_size

The slot size of the heap in bytes.

heap_allocatable_pages

The number of pages that can be allocated without triggering a new garbage collection cycle.

heap_eden_pages

The number of pages in the eden heap.

heap_eden_slots

The total number of slots in all of the pages in the eden heap.

heap_tomb_pages

The number of pages in the tomb heap. The tomb heap only contains pages that do not have any live objects.

heap_tomb_slots

The total number of slots in all of the pages in the tomb heap.

total_allocated_pages

The total number of pages that have been allocated in the heap.

total_freed_pages

The total number of pages that have been freed and released back to the system in the heap.

force_major_gc_count

The number of times major garbage collection cycles this heap has forced to start due to running out of free slots.

force_incremental_marking_finish_count

The number of times this heap has forced incremental marking to complete due to running out of pooled slots.

The path to standard location of the user’s state file.

The path to standard location of the user’s state directory.

How String Gem paths should be split. Overridable for esoteric platforms.

Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names, instance variable names, or constant names (see def_delegator). The value is the accessor to which the methods will be delegated.

Returns a Process::Status object representing the most recently exited child process in the current thread, or nil if none:

Process.spawn('ruby', '-e', 'exit 13')
Process.wait
Process.last_status # => #<Process::Status: pid 14396 exit 13>

Process.spawn('ruby', '-e', 'exit 14')
Process.wait
Process.last_status # => #<Process::Status: pid 4692 exit 14>

Process.spawn('ruby', '-e', 'exit 15')
# 'exit 15' has not been reaped by #wait.
Process.last_status # => #<Process::Status: pid 4692 exit 14>
Process.wait
Process.last_status # => #<Process::Status: pid 1380 exit 15>

Update the digest using given string and return self.

Update the digest using a given string and return self.

Encrypts data in a streaming fashion. Hand consecutive blocks of data to the update method in order to encrypt it. Returns the encrypted data chunk. When done, the output of Cipher#final should be additionally added to the result.

If buffer is given, the encryption/decryption result will be written to it. buffer will be resized automatically.

Not every message digest can be computed in one single pass. If a message digest is to be computed from several subsequent sources, then each may be passed individually to the Digest instance.

Example

digest = OpenSSL::Digest.new('SHA256')
digest.update('First input')
digest << 'Second input' # equivalent to digest.update('Second input')
result = digest.digest

Returns hmac updated with the message to be authenticated. Can be called repeatedly with chunks of the message.

Example

first_chunk = 'The quick brown fox jumps '
second_chunk = 'over the lazy dog'

instance.update(first_chunk)
#=> 5b9a8038a65d571076d97fe783989e52278a492a
instance.update(second_chunk)
#=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9

Get the indentation level.

Set the indentation level to level. The level must be less than 10 and greater than 1.

Returns the exit status of the child for which PTY#check raised this exception

The scanner’s state of the current token. This value is the bitwise OR of zero or more of the Ripper::EXPR_* constants.

Search took: 4ms  ·  Total Results: 1843