This module gets prepended into RuboCop::AST::ProcessedSource.
Get the distributionPoint fullName URI
from the certificate’s CRL
distribution points extension, as described in RFC5280 Section 4.2.1.13
Returns an array of strings or nil or raises ASN1::ASN1Error
.
Get the URIs for OCSP
from the certificate’s authority information access extension exteension, as described in RFC5280 Section 4.2.2.1.
Returns an array of strings or nil or raises ASN1::ASN1Error
.
Get the information and services for the issuer from the certificate’s authority information access extension exteension, as described in RFC5280 Section 4.2.2.1.
Returns an array of strings or nil or raises ASN1::ASN1Error
.
Returns the priority of thr. Default is inherited from the current thread which creating the new thread, or zero for the initial main thread; higher-priority thread will run more frequently than lower-priority threads (but lower-priority threads can also run).
This is just hint for Ruby thread scheduler. It may be ignored on some platform.
Thread.current.priority #=> 0
Sets the priority of thr to integer. Higher-priority threads will run more frequently than lower-priority threads (but lower-priority threads can also run).
This is just hint for Ruby thread scheduler. It may be ignored on some platform.
count1 = count2 = 0 a = Thread.new do loop { count1 += 1 } end a.priority = -1 b = Thread.new do loop { count2 += 1 } end b.priority = -2 sleep 1 #=> 1 count1 #=> 622504 count2 #=> 5832
Returns the scheduling priority for specified process, process group, or user.
Argument kind
is one of:
Process::PRIO_PROCESS
: return priority for process.
Process::PRIO_PGRP
: return priority for process group.
Process::PRIO_USER
: return priority for user.
Argument id
is the ID for the process, process group, or user; zero specified the current ID for kind
.
Examples:
Process.getpriority(Process::PRIO_USER, 0) # => 19 Process.getpriority(Process::PRIO_PROCESS, 0) # => 19
Not available on all platforms.
See Process.getpriority
.
Examples:
Process.setpriority(Process::PRIO_USER, 0, 19) # => 0 Process.setpriority(Process::PRIO_PROCESS, 0, 19) # => 0 Process.getpriority(Process::PRIO_USER, 0) # => 19 Process.getpriority(Process::PRIO_PROCESS, 0) # => 19
Not available on all platforms.
Waits until IO
is priority and returns a truthy value or a falsy value when times out. Priority data is sent and received using the Socket::MSG_OOB flag and is typically limited to streams.
You must require ‘io/wait’ to use this method.
Returns URL-escaped string following RFC 3986.
Returns URL-unescaped string following RFC 3986.
URL-encode a string following RFC 3986 Space characters (+“ ”+) are encoded with (+“%20”+)
url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred") # => "%27Stop%21%27%20said%20Fred"
URL-decode a string following RFC 3986 with encoding(optional).
string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred") # => "'Stop!'+said Fred"
Quietly ensure the Gem directory dir
contains all the proper subdirectories. If we can’t create a directory due to a permission problem, then we will silently continue.
If mode
is given, missing directories are created with this mode.
World-writable directories will never be created.
primitive_errinfo
returns important information regarding the last error as a 5-element array:
[result, enc1, enc2, error_bytes, readagain_bytes]
result is the last result of primitive_convert.
Other elements are only meaningful when result is :invalid_byte_sequence, :incomplete_input or :undefined_conversion.
enc1 and enc2 indicate a conversion step as a pair of strings. For example, a converter from EUC-JP to ISO-8859-1 converts a string as follows: EUC-JP -> UTF-8 -> ISO-8859-1. So [enc1, enc2] is either [“EUC-JP”, “UTF-8”] or [“UTF-8”, “ISO-8859-1”].
error_bytes and readagain_bytes indicate the byte sequences which caused the error. error_bytes is discarded portion. readagain_bytes is buffered portion which is read again on next conversion.
Example:
# \xff is invalid as EUC-JP. ec = Encoding::Converter.new("EUC-JP", "Shift_JIS") ec.primitive_convert(src="\xff", dst="", nil, 10) p ec.primitive_errinfo #=> [:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", ""] # HIRAGANA LETTER A (\xa4\xa2 in EUC-JP) is not representable in ISO-8859-1. # Since this error is occur in UTF-8 to ISO-8859-1 conversion, # error_bytes is HIRAGANA LETTER A in UTF-8 (\xE3\x81\x82). ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") ec.primitive_convert(src="\xa4\xa2", dst="", nil, 10) p ec.primitive_errinfo #=> [:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", ""] # partial character is invalid ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") ec.primitive_convert(src="\xa4", dst="", nil, 10) p ec.primitive_errinfo #=> [:incomplete_input, "EUC-JP", "UTF-8", "\xA4", ""] # Encoding::Converter::PARTIAL_INPUT prevents invalid errors by # partial characters. ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") ec.primitive_convert(src="\xa4", dst="", nil, 10, Encoding::Converter::PARTIAL_INPUT) p ec.primitive_errinfo #=> [:source_buffer_empty, nil, nil, nil, nil] # \xd8\x00\x00@ is invalid as UTF-16BE because # no low surrogate after high surrogate (\xd8\x00). # It is detected by 3rd byte (\00) which is part of next character. # So the high surrogate (\xd8\x00) is discarded and # the 3rd byte is read again later. # Since the byte is buffered in ec, it is dropped from src. ec = Encoding::Converter.new("UTF-16BE", "UTF-8") ec.primitive_convert(src="\xd8\x00\x00@", dst="", nil, 10) p ec.primitive_errinfo #=> [:invalid_byte_sequence, "UTF-16BE", "UTF-8", "\xD8\x00", "\x00"] p src #=> "@" # Similar to UTF-16BE, \x00\xd8@\x00 is invalid as UTF-16LE. # The problem is detected by 4th byte. ec = Encoding::Converter.new("UTF-16LE", "UTF-8") ec.primitive_convert(src="\x00\xd8@\x00", dst="", nil, 10) p ec.primitive_errinfo #=> [:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "@\x00"] p src #=> ""
Temporarily turn off warnings. Intended for tests only.
Temporarily turn off warnings. Intended for tests only.
Quietly ensure the Gem directory dir
contains all the proper subdirectories for handling default gems. If we can’t create a directory due to a permission problem, then we will silently continue.
If mode
is given, missing directories are created with this mode.
World-writable directories will never be created.
If the SOURCE_DATE_EPOCH environment variable is set, returns it’s value. Otherwise, returns the time that Gem.source_date_epoch_string
was first called in the same format as SOURCE_DATE_EPOCH.
NOTE(@duckinator): The implementation is a tad weird because we want to:
1. Make builds reproducible by default, by having this function always return the same result during a given run. 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple tests that set this variable will be run in a single process.
If you simplify this function and a lot of tests fail, that is likely due to #2 above.
Details on SOURCE_DATE_EPOCH: reproducible-builds.org/specs/source-date-epoch/
Regular gems take precedence over default gems