Open a file with given flags, and protect access with a file lock
Open a file with given flags, and protect access with flock
Returns a URL-encoded string derived from the given string str
.
The returned string:
Preserves:
Characters '*'
, '.'
, '-'
, and '_'
.
Character in ranges 'a'..'z'
, 'A'..'Z'
, and '0'..'9'
.
Example:
URI.encode_www_form_component('*.-_azAZ09') # => "*.-_azAZ09"
Converts:
Character ' '
to character '+'
.
Any other character to “percent notation”; the percent notation for character c is '%%%X' % c.ord
.
Example:
URI.encode_www_form_component('Here are some punctuation characters: ,;?:') # => "Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A"
Encoding:
If str
has encoding Encoding::ASCII_8BIT, argument enc
is ignored.
Otherwise str
is converted first to Encoding::UTF_8 (with suitable character replacements), and then to encoding enc
.
In either case, the returned string has forced encoding Encoding::US_ASCII.
Related: URI.encode_uri_component
(encodes ' '
as '%20'
).
Returns a string decoded from the given URL-encoded string str
.
The given string is first encoded as Encoding::ASCII-8BIT (using String#b
), then decoded (as below), and finally force-encoded to the given encoding enc
.
The returned string:
Preserves:
Characters '*'
, '.'
, '-'
, and '_'
.
Character in ranges 'a'..'z'
, 'A'..'Z'
, and '0'..'9'
.
Example:
URI.decode_www_form_component('*.-_azAZ09') # => "*.-_azAZ09"
Converts:
Character '+'
to character ' '
.
Each “percent notation” to an ASCII character.
Example:
URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A') # => "Here are some punctuation characters: ,;?:"
Related: URI.decode_uri_component
(preserves '+'
).
Returns the string that is used to insert a space before the ‘:’ in JSON
objects.
Sets the string that is used to insert a space before the ‘:’ in JSON
objects.
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.
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 true, if circular data structures should be checked, otherwise returns false.
Returns true, if only ASCII characters should be generated. Otherwise returns false.
This sets whether only ASCII characters should be generated.
When *, **, &, or … are used as an argument in a method call, we check if they were allowed by the current context. To determine that we build this lookup table.
Visit a block node on a call.
Visit a heredoc that can be either a string or an xstring.
Visit a numeric node and account for the optional sign.
Determine if the string is part of a %-style array.
Visit a block node, which will modify the AST by wrapping the given visited node in an iter node.