Results for: "gsub"

TextConstruct that conveys a description or subtitle for a Feed.

Reference: validator.w3.org/feed/docs/rfc4287.html#element.subtitle

This class walks a YAML AST, converting each node to Ruby

No documentation available
No documentation available

Root of the HTTP success statuses

No documentation available

An error caused by searching for a dependency that is completely unknown, i.e. has no versions available whatsoever.

No documentation available
No documentation available
No documentation available

DateConstruct that usually indicates the time of the initial creation of an Entry.

Reference: validator.w3.org/feed/docs/rfc4287.html#element.published

TextConstruct that describes a summary of the Entry.

Reference: validator.w3.org/feed/docs/rfc4287.html#element.summary

No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available

Performs the substitutions of String#gsub in place, returning str, or nil if no substitutions were performed. If no block and no replacement is given, an enumerator is returned instead.

Returns a copy of str with the first occurrence of pattern replaced by the second argument. The pattern is typically a Regexp; if given as a String, any regular expression metacharacters it contains will be interpreted literally, e.g. \d will match a backslash followed by ‘d’, instead of a digit.

If replacement is a String it will be substituted for the matched text. It may contain back-references to the pattern’s capture groups of the form \d, where d is a group number, or \k<n>, where n is a group name. Similarly, \&, \', \`, and + correspond to special variables, $&, $', $`, and $+, respectively. (See regexp.rdoc for details.) \0 is the same as \&. \\ is interpreted as an escape, i.e., a single backslash. Note that, within replacement the special match variables, such as $&, will not refer to the current match.

If the second argument is a Hash, and the matched text is one of its keys, the corresponding value is the replacement string.

In the block form, the current match string is passed in as a parameter, and variables such as $1, $2, $`, $&, and $' will be set appropriately. (See regexp.rdoc for details.) The value returned by the block will be substituted for the match on each call.

"hello".sub(/[aeiou]/, '*')                  #=> "h*llo"
"hello".sub(/([aeiou])/, '<\1>')             #=> "h<e>llo"
"hello".sub(/./) {|s| s.ord.to_s + ' ' }     #=> "104 ello"
"hello".sub(/(?<foo>[aeiou])/, '*\k<foo>*')  #=> "h*e*llo"
'Is SHELL your preferred shell?'.sub(/[[:upper:]]{2,}/, ENV)
 #=> "Is /bin/bash your preferred shell?"

Note that a string literal consumes backslashes. (See syntax/literals.rdoc for details about string literals.) Back-references are typically preceded by an additional backslash. For example, if you want to write a back-reference \& in replacement with a double-quoted string literal, you need to write: "..\\&..". If you want to write a non-back-reference string \& in replacement, you need first to escape the backslash to prevent this method from interpreting it as a back-reference, and then you need to escape the backslashes again to prevent a string literal from consuming them: "..\\\\&..". You may want to use the block form to avoid a lot of backslashes.

Performs the same substitution as String#sub in-place.

Returns str if a substitution was performed or nil if no substitution was performed.

Subtract the specified value.

e.g.

c = a.sub(b,n)
digits

If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.

Returns the fraction for time.

The return value can be a rational number.

t = Time.now        #=> 2009-03-26 22:33:12 +0900
"%10.9f" % t.to_f   #=> "1238074392.940563917"
t.subsec            #=> (94056401/100000000)

The lowest digits of to_f and subsec are different because IEEE 754 double is not accurate enough to represent the rational number.

The more accurate value is returned by subsec.

Returns true if the set is a subset of the given set.

Search took: 1ms  ·  Total Results: 282