Method: REXML::Element#clone
- Defined in:
- lib/rexml/element.rb
#clone ⇒ Object
:call-seq:
clone -> new_element
Returns a shallow copy of the element, containing the name and attributes, but not the parent or children:
e = REXML::Element.new('foo')
e.add_attributes({'bar' => 0, 'baz' => 1})
e.clone # => <foo bar='0' baz='1'/>
383 384 385 |
# File 'lib/rexml/element.rb', line 383 def clone self.class.new self end |