Returns the netmask address of ifaddr. nil is returned if netmask is not available in ifaddr.
returns the socket option data as a string.
p Socket::Option.new(:INET6, :IPV6, :RECVPKTINFO, [1].pack("i!")).data #=> "\x01\x00\x00\x00"
Logs a message
at the fatal (syslog err) log level, or logs the message returned from the block.
Compresses the given string
. Valid values of level are Zlib::NO_COMPRESSION, Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_COMPRESSION, or an integer from 0 to 9.
This method is almost equivalent to the following code:
def deflate(string, level) z = Zlib::Deflate.new(level) dst = z.deflate(string, Zlib::FINISH) z.close dst end
See also Zlib.inflate
Inputs string
into the deflate stream and returns the output from the stream. On calling this method, both the input and the output buffers of the stream are flushed. If string
is nil, this method finishes the stream, just like Zlib::ZStream#finish
.
If a block is given consecutive deflated chunks from the string
are yielded to the block and nil
is returned.
The flush
parameter specifies the flush mode. The following constants may be used:
The default
Flushes the output to a byte boundary
SYNC_FLUSH + resets the compression state
Pending input is processed, pending output is flushed.
See the constants for further description.
Decompresses string
. Raises a Zlib::NeedDict
exception if a preset dictionary is needed for decompression.
This method is almost equivalent to the following code:
def inflate(string) zstream = Zlib::Inflate.new buf = zstream.inflate(string) zstream.finish zstream.close buf end
See also Zlib.deflate
Inputs deflate_string
into the inflate stream and returns the output from the stream. Calling this method, both the input and the output buffer of the stream are flushed. If string is nil
, this method finishes the stream, just like Zlib::ZStream#finish
.
If a block is given consecutive inflated chunks from the deflate_string
are yielded to the block and nil
is returned.
Raises a Zlib::NeedDict
exception if a preset dictionary is needed to decompress. Set
the dictionary by Zlib::Inflate#set_dictionary
and then call this method again with an empty string to flush the stream:
inflater = Zlib::Inflate.new begin out = inflater.inflate compressed rescue Zlib::NeedDict # ensure the dictionary matches the stream's required dictionary raise unless inflater.adler == Zlib.adler32(dictionary) inflater.set_dictionary dictionary inflater.inflate '' end # ... inflater.close
See also Zlib::Inflate.new
Same as IO
.
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
Returns the last access time for this file as an object of class Time
.
File.stat("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
Returns true
if the file is a character device, false
if it isn’t or if the operating system doesn’t support this feature.
File.stat("/dev/tty").chardev? #=> true
Iterates over keys and objects in a weakly referenced object
Returns the path of this instruction sequence.
<compiled>
if the iseq was evaluated from a string.
For example, using irb:
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2') #=> <RubyVM::InstructionSequence:<compiled>@<compiled>> iseq.path #=> "<compiled>"
Using ::compile_file
:
# /tmp/method.rb def hello puts "hello, world" end # in irb > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb') > iseq.path #=> /tmp/method.rb
The platform this gem runs on.
This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT.
Most gems contain pure Ruby code; they should simply leave the default value in place. Some gems contain C (or other) code to be compiled into a Ruby “extension”. The gem should leave the default value in place unless the code will only compile on a certain type of system. Some gems consist of pre-compiled code (“binary gems”). It’s especially important that they set the platform attribute appropriately. A shortcut is to set the platform to Gem::Platform::CURRENT, which will cause the gem builder to set the platform to the appropriate value for the system on which the build is being performed.
If this attribute is set to a non-default value, it will be included in the filename of the gem when it is built such as: nokogiri-1.6.0-x86-mingw32.gem
Usage:
spec.platform = Gem::Platform.local
Enumerate every known spec. See ::dirs=
and ::add_spec
to set the list of specs.
Return a list of all outdated local gem names. This method is HEAVY as it must go fetch specifications from the server.
Use outdated_and_latest_version
if you wish to retrieve the latest remote version as well.
Activate this spec, registering it as a loaded spec and adding it’s lib paths to $LOAD_PATH. Returns true if the spec was activated, false if it was previously activated. Freaks out if there are conflicts upon activation.
Abbreviate the spec for downloading. Abbreviated specs are only used for searching, downloading and related activities and do not need deployment specific information (e.g. list of files). So we abbreviate the spec, making it much smaller for quicker downloads.
The date this gem was created.
If SOURCE_DATE_EPOCH is set as an environment variable, use that to support reproducible builds; otherwise, default to the current UTC date.
Details on SOURCE_DATE_EPOCH: reproducible-builds.org/specs/source-date-epoch/
The date this gem was created
DO NOT set this, it is set automatically when the gem is packaged.
Normalize the list of files so that:
All file lists have redundancies removed.
Files referenced in the extra_rdoc_files
are included in the package file list.
The platform this gem runs on. See Gem::Platform
for details.