Results for: "String#[]"

Returns the +index+th prime number.

index is a 0-based index.

Access the attlist attribute/value pairs.

value = attlist_decl[ attribute_name ]

Fetches an attribute value or a child.

If String or Symbol is specified, it’s treated as attribute name. Attribute value as String or nil is returned. This case is shortcut of attributes[name].

If Integer is specified, it’s treated as the index of child. It returns Nth child.

doc = REXML::Document.new("<a attr='1'><b/><c/></a>")
doc.root["attr"]             # => "1"
doc.root.attributes["attr"]  # => "1"
doc.root[1]                  # => <c/>

Fetches a child element. Filters only Element children, regardless of the XPath match.

index

the search parameter. This is either an Integer, which will be used to find the index’th child Element, or an XPath, which will be used to search for the Element. Because of the nature of XPath searches, any element in the connected XML document can be fetched through any other element. The Integer index is 1-based, not 0-based. This means that the first child element is at index 1, not 0, and the +n+th element is at index n, not n-1. This is because XPath indexes element children starting from 1, not 0, and the indexes should be the same.

name

optional, and only used in the first argument is an Integer. In that case, the index’th child Element that has the supplied name will be returned. Note again that the indexes start at 1.

Returns

the first matching Element, or nil if no child matched

doc = Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
doc.root.elements[1]       #-> <b/>
doc.root.elements['c']     #-> <c id="1"/>
doc.root.elements[2,'c']   #-> <c id="2"/>

Fetches an attribute value. If you want to get the Attribute itself, use get_attribute()

name

an XPath attribute name. Namespaces are relevant here.

Returns

the String value of the matching attribute, or nil if no matching attribute was found. This is the unnormalized value (with entities expanded).

doc = Document.new "<a foo:att='1' bar:att='2' att='&lt;'/>"
doc.root.attributes['att']         #-> '<'
doc.root.attributes['bar:att']     #-> '2'

Fetches a child at a given index @param index the Integer index of the child to fetch

Accessor method for elements of the tuple.

Retrieves key from the tuple.

Returns a Command instance for command_name

Return the configuration information for key.

See Shell::CommandProcessor#test

Reads key from the configuration

Retrieves header_name

Retrieves the response header field

Retrieves key from the configuration

Return value associated with key from database.

Returns nil if there is no such key.

See fetch for more information.

Returns the function mapped to name, that was created by either Fiddle::Importer.extern or Fiddle::Importer.bind

Get the value for the parameter with a given key.

If the parameter has multiple values, only the first will be retrieved; use params to get the array of values.

Returns the header field corresponding to the case-insensitive key. For example, a key of “Content-Type” might return “text/html”

Returns the maker for the version

Returns the status class corresponding to code

WEBrick::HTTPStatus[302]
=> WEBrick::HTTPStatus::NotFound
No documentation available

Processes a copy of str as described under String#tr, then removes duplicate characters in regions that were affected by the translation.

"hello".tr_s('l', 'r')     #=> "hero"
"hello".tr_s('el', '*')    #=> "h*o"
"hello".tr_s('el', 'hx')   #=> "hhxo"

Try to convert obj into a String, using to_str method. Returns converted string or nil if obj cannot be converted for any reason.

String.try_convert("str")     #=> "str"
String.try_convert(/re/)      #=> nil

Replaces the contents and taintedness of str with the corresponding values in other_str.

s = "hello"         #=> "hello"
s.replace "world"   #=> "world"
Search took: 4ms  ·  Total Results: 3008