Results for: "remove_const"

Specify the encoding of the StringIO as ext_enc. Use the default external encoding if ext_enc is nil. 2nd argument int_enc and optional hash opt argument are ignored; they are for API compatibility to IO.

Returns a shallow copy of self; the [stored string] in the copy is the same string as in self.

Returns the substring that follows the matched substring from the most recent match attempt if it was successful, or nil otherwise; see [Basic Match Values]:

scanner = StringScanner.new('foobarbaz')
scanner.post_match     # => nil

scanner.pos = 3
scanner.match?(/bar/)  # => 3
scanner.post_match     # => "baz"

scanner.match?(/nope/) # => nil
scanner.post_match     # => nil

Replaces the entire contents of self with the contents of other_hash; returns self:

h = {foo: 0, bar: 1, baz: 2}
h.replace({bat: 3, bam: 4}) # => {bat: 3, bam: 4}

Related: see Methods for Assigning.

With an argument, a block, or both given, derives a new hash new_hash from self, the argument, and/or the block; all, some, or none of its keys may be different from those in self.

With a block given and no argument, new_hash has keys determined only by the block.

For each key/value pair old_key/value in self, calls the block with old_key; the block’s return value becomes new_key; sets new_hash[new_key] = value; a duplicate key overwrites:

h = {foo: 0, bar: 1, baz: 2}
h.transform_keys {|old_key| old_key.to_s }
# => {"foo" => 0, "bar" => 1, "baz" => 2}
h.transform_keys {|old_key| 'xxx' }
# => {"xxx" => 2}

With argument other_hash given and no block, new_hash may have new keys provided by other_hash and unchanged keys provided by self.

For each key/value pair old_key/old_value in self, looks for key old_key in other_hash:

Unused keys in other_hash are ignored:

h = {foo: 0, bar: 1, baz: 2}
h.transform_keys(bat: 3)
# => {foo: 0, bar: 1, baz: 2}

With both argument other_hash and a block given, new_hash has new keys specified by other_hash or by the block, and unchanged keys provided by self.

For each pair old_key and value in self:

With no argument and no block given, returns a new Enumerator.

Related: see Methods for Transforming Keys and Values.

With an argument, a block, or both given, derives keys from the argument, the block, and self; all, some, or none of the keys in self may be changed.

With a block given and no argument, derives keys only from the block; all, some, or none of the keys in self may be changed.

For each key/value pair old_key/value in self, calls the block with old_key; the block’s return value becomes new_key; removes the entry for old_key: self.delete(old_key); sets self[new_key] = value; a duplicate key overwrites:

h = {foo: 0, bar: 1, baz: 2}
h.transform_keys! {|old_key| old_key.to_s }
# => {"foo" => 0, "bar" => 1, "baz" => 2}
h = {foo: 0, bar: 1, baz: 2}
h.transform_keys! {|old_key| 'xxx' }
# => {"xxx" => 2}

With argument other_hash given and no block, derives keys for self from other_hash and self; all, some, or none of the keys in self may be changed.

For each key/value pair old_key/old_value in self, looks for key old_key in other_hash:

Unused keys in other_hash are ignored:

h = {foo: 0, bar: 1, baz: 2}
h.transform_keys!(bat: 3)
# => {foo: 0, bar: 1, baz: 2}

With both argument other_hash and a block given, derives keys from other_hash, the block, and self; all, some, or none of the keys in self may be changed.

For each pair old_key and value in self:

With no argument and no block given, returns a new Enumerator.

Related: see Methods for Transforming Keys and Values.

With a block given, returns a new hash new_hash; for each pair key/value in self, calls the block with value and captures its return as new_value; adds to new_hash the entry key/new_value:

h = {foo: 0, bar: 1, baz: 2}
h1 = h.transform_values {|value| value * 100}
h1 # => {foo: 0, bar: 100, baz: 200}

With no block given, returns a new Enumerator.

Related: see Methods for Transforming Keys and Values.

With a block given, changes the values of self as determined by the block; returns self.

For each entry key/old_value in self, calls the block with old_value, captures its return value as new_value, and sets self[key] = new_value:

h = {foo: 0, bar: 1, baz: 2}
h.transform_values! {|value| value * 100} # => {foo: 0, bar: 100, baz: 200}

With no block given, returns a new Enumerator.

Related: see Methods for Transforming Keys and Values.

Iterates over each codepoint of each file in ARGF.

This method allows you to treat the files supplied on the command line as a single file consisting of the concatenation of each named file. After the last codepoint of the first file has been returned, the first codepoint of the second file is returned. The ARGF.filename method can be used to determine the name of the file in which the current codepoint appears.

If no block is given, an enumerator is returned instead.

Returns the external encoding for files read from ARGF as an Encoding object. The external encoding is the encoding of the text as stored in a file. Contrast with ARGF.internal_encoding, which is the encoding used to represent this text within Ruby.

To set the external encoding use ARGF.set_encoding.

For example:

ARGF.external_encoding  #=>  #<Encoding:UTF-8>

Returns the internal encoding for strings read from ARGF as an Encoding object.

If ARGF.set_encoding has been called with two encoding names, the second is returned. Otherwise, if Encoding.default_external has been set, that value is returned. Failing that, if a default external encoding was specified on the command-line, that value is used. If the encoding is unknown, nil is returned.

If single argument is specified, strings read from ARGF are tagged with the encoding specified.

If two encoding names separated by a colon are given, e.g. “ascii:utf-8”, the read string is converted from the first encoding (external encoding) to the second encoding (internal encoding), then tagged with the second encoding.

If two arguments are specified, they must be encoding objects or encoding names. Again, the first specifies the external encoding; the second specifies the internal encoding.

If the external encoding and the internal encoding are specified, the optional Hash argument can be used to adjust the conversion process. The structure of this hash is explained in the String#encode documentation.

For example:

ARGF.set_encoding('ascii')         # Tag the input as US-ASCII text
ARGF.set_encoding(Encoding::UTF_8) # Tag the input as UTF-8 text
ARGF.set_encoding('utf-8','ascii') # Transcode the input from US-ASCII
                                   # to UTF-8.

Creates a new compiler for ERB. See ERB::Compiler.new for details

Returns a string containing the IP address representation in canonical form.

Returns a string containing the IP address representation with prefix.

Returns a json string containing the IP address representation.

Returns true if the ipaddr is an IPv4-compatible IPv6 address.

No documentation available

Returns a new ipaddr built by converting the native IPv4 address into an IPv4-compatible IPv6 address.

Returns the IPv6 zone identifier, if present. Raises InvalidAddressError if not an IPv6 address.

Returns the IPv6 zone identifier, if present. Raises InvalidAddressError if not an IPv6 address.

No documentation available
No documentation available
No documentation available

Creates an option from the given parameters params. See Parameters for New Options.

The block, if given, is the handler for the created option. When the option is encountered during command-line parsing, the block is called with the argument given for the option, if any. See Option Handlers.

The new option is added at the head of the summary.

Search took: 4ms  ·  Total Results: 3274