Returns integer 80
, the default port to use for HTTP requests:
Net::HTTP.http_default_port # => 80
Returns integer 443
, the default port to use for HTTPS requests:
Net::HTTP.https_default_port # => 443
Sets the encoding to be used for the response body; returns the encoding.
The given value
may be:
An Encoding
object.
The name of an encoding.
An alias for an encoding name.
See Encoding
.
Examples:
http = Net::HTTP.new(hostname) http.response_body_encoding = Encoding::US_ASCII # => #<Encoding:US-ASCII> http.response_body_encoding = 'US-ASCII' # => "US-ASCII" http.response_body_encoding = 'ASCII' # => "ASCII"
Returns integer 80
, the default port to use for HTTP requests:
Net::HTTP.http_default_port # => 80
Returns integer 443
, the default port to use for HTTPS requests:
Net::HTTP.https_default_port # => 443
Sets the encoding to be used for the response body; returns the encoding.
The given value
may be:
An Encoding
object.
The name of an encoding.
An alias for an encoding name.
See Encoding
.
Examples:
http = Net::HTTP.new(hostname) http.response_body_encoding = Encoding::US_ASCII # => #<Encoding:US-ASCII> http.response_body_encoding = 'US-ASCII' # => "US-ASCII" http.response_body_encoding = 'ASCII' # => "ASCII"
Returns whether the request may have a body:
Net::HTTP::Post.new(uri).request_body_permitted? # => true Net::HTTP::Get.new(uri).request_body_permitted? # => false
Define --enable
/ --disable
style option
Appears as --enable-name
in help message.
Define --enable
/ --disable
style option
Appears as --disable-name
in help message.
Returns the offset from the start of the file for the given byte offset counting in code units for the given encoding.
This method is tested with UTF-8, UTF-16, and UTF-32. If there is the concept of code units that differs from the number of characters in other encodings, it is not captured here.
We purposefully replace invalid and undefined characters with replacement characters in this conversion. This happens for two reasons. First, it’s possible that the given byte offset will not occur on a character boundary. Second, it’s possible that the source code will contain a character that has no equivalent in the given encoding.
Generate a cache that targets a specific encoding for calculating code unit offsets.
Returns the column number in code units for the given encoding for the given byte offset.
Returns the offset from the start of the file for the given byte offset counting in code units for the given encoding.
This method is tested with UTF-8, UTF-16, and UTF-32. If there is the concept of code units that differs from the number of characters in other encodings, it is not captured here.
Returns a cache that is the identity function in order to maintain the same interface. We can do this because code units are always equivalent to byte offsets for ASCII-only sources.
Specialized version of code_units_column
that does not depend on code_units_offset
, which is a more expensive operation. This is essentially the same as Prism::Source#column
.
The character offset from the beginning of the source where this location ends.
The column number in characters where this location ends from the start of the line.
Create a code units cache for the given encoding.
Compile a name associated with a constant.
Return true if this spec can require file
.
The full path to the gem (install path + full name).
TODO: This is duplicated with gem_dir
. Eventually either of them should be deprecated.
Full paths in the gem to add to $LOAD_PATH
when this gem is activated.
Return an array of extra arguments for the command. The extra arguments come from the gem configuration file read at program startup.