Module: XMLObject

Defined in:
lib/xml-object/adapters.rb,
lib/xml-object.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Adapters, Element, Properties Classes: CollectionProxy

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.adapterObject

:nodoc:



4
5
6
# File 'lib/xml-object/adapters.rb', line 4

def adapter
  @adapter
end

Class Method Details

.new(duck) ⇒ Object

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



15
16
17
18
19
20
21
# File 'lib/xml-object.rb', line 15

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