Results for: "module_function"

Enables SMTP/TLS (SMTPS: SMTP over direct TLS connection) for this object. Must be called before the connection is established to have any effect. context is a OpenSSL::SSL::SSLContext object.

No documentation available

Disables SMTP/TLS for this object. Must be called before the connection is established to have any effect.

No documentation available

Enables SMTP/TLS (STARTTLS) for this object. context is a OpenSSL::SSL::SSLContext object.

Disables SMTP/TLS (STARTTLS) for this object. Must be called before the connection is established to have any effect.

No documentation available

validates typecode v, returns a true or false boolean

Private setter for the typecode v

see also URI::FTP.typecode=

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

Evaluates to the root node of the document that this element belongs to. If this element doesn’t belong to a document, but does belong to another Element, the parent’s root will be returned, until the earliest ancestor is found.

Note that this is not the same as the document element. In the following example, <a> is the document element, and the root node is the parent node of the document element. You may ask yourself why the root node is useful: consider the doctype and XML declaration, and any processing instructions before the document element… they are children of the root node, or siblings of the document element. The only time this isn’t true is when an Element is created that is not part of any Document. In this case, the ancestor that has no parent acts as the root node.

d = Document.new '<a><b><c/></b></a>'
a = d[1] ; c = a[1][1]
d.root_node == d   # TRUE
a.root_node        # namely, d
c.root_node        # again, d

Removes a namespace from this node. This only works if the namespace is actually declared in this node. If no argument is passed, deletes the default namespace.

Evaluates to: this element

doc = Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
doc.root.delete_namespace
puts doc     # -> <a xmlns:foo='bar'/>
doc.root.delete_namespace 'foo'
puts doc     # -> <a/>

Adds a child to this element, optionally setting attributes in the element.

element

optional. If Element, the element is added. Otherwise, a new Element is constructed with the argument (see Element.initialize).

attrs

If supplied, must be a Hash containing String name,value pairs, which will be used to set the attributes of the new Element.

Returns

the Element that was added

el = doc.add_element 'my-tag'
el = doc.add_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'}
el = Element.new 'my-tag'
doc.add_element el

Evaluates to true if this element has at least one child Element

doc = Document.new "<a><b/><c>Text</c></a>"
doc.root.has_elements               # -> true
doc.elements["/a/b"].has_elements   # -> false
doc.elements["/a/c"].has_elements   # -> false

Synonym for Element.elements.each

Synonym for Element.to_a This is a little slower than calling elements.each directly.

xpath

any XPath by which to search for elements in the tree

Returns

an array of Elements that match the supplied path

Returns the next sibling that is an element, or nil if there is no Element sibling after this one

doc = Document.new '<a><b/>text<c/></a>'
doc.root.elements['b'].next_element          #-> <c/>
doc.root.elements['c'].next_element          #-> nil
No documentation available

Removes an attribute

key

either an Attribute or a String. In either case, the attribute is found by matching the attribute name to the argument, and then removed. If no attribute is found, no action is taken.

Returns

the attribute removed, or nil if this Element did not contain a matching attribute

e = Element.new('E')
e.add_attribute( 'name', 'Sean' )             #-> <E name='Sean'/>
r = e.add_attribute( 'sur:name', 'Russell' )  #-> <E name='Sean' sur:name='Russell'/>
e.delete_attribute( 'name' )                  #-> <E sur:name='Russell'/>
e.delete_attribute( r )                       #-> <E/>

Removes multiple elements. Filters for Element children, regardless of XPath matching.

xpath

all elements matching this String path are removed.

Returns

an Array of Elements that have been removed

doc = Document.new '<a><c/><c/><c/><c/></a>'
deleted = doc.elements.delete_all 'a/c' #-> [<c/>, <c/>, <c/>, <c/>]
Search took: 5ms  ·  Total Results: 3558