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
Root of the HTTP success statuses
An error caused by searching for a dependency that is completely unknown, i.e. has no versions available whatsoever.
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
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. If it is a double-quoted string, both back-references must be preceded by an additional backslash. However, within replacement
the special match variables, such as $&
, will not refer to the current match. If replacement
is a String
that looks like a pattern’s capture group but is actually not a pattern capture group e.g. "\'"
, then it will have to be preceded by two backslashes like so "\\'"
.
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. The value returned by the block will be substituted for the match on each call.
The result inherits any tainting in the original string or any supplied replacement string.
"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?"
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)
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
.
Return a pathname which is substituted by String#sub
.
path1 = Pathname.new('/usr/bin/perl') path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
Returns true if the set is a subset of the given set.