Method: XMLObject.new

Defined in:
lib/xml-object.rb

.new(duck) ⇒ Object

Returns a String or Array object representing the given XML, decorated with methods to access attributes and/or child elements.



11
12
13
14
15
16
17
# File 'lib/xml-object.rb', line 11

def self.new(duck) # :nodoc:
  case duck
    when @adapter::Element then new_decorated_obj duck
    when Array             then duck.map! { |d| new_decorated_obj d }
    else new @adapter.new(duck)
  end
end