Module: XMLObject

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

Overview

:nodoc:

Defined Under Namespace

Modules: Adapters, ArrayNotation, Element, MethodMissingDispatchers, String Classes: BlankishSlate, CollectionProxy

Class Method Summary collapse

Class Method Details

.adapterObject

:nodoc:



38
39
40
# File 'lib/xml-object/adapters/rexml.rb', line 38

def XMLObject.adapter # :nodoc:
  XMLObject::Adapters::REXML
end

.new(duck) ⇒ Object

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



19
20
21
22
23
24
25
# File 'lib/xml-object.rb', line 19

def self.new(duck)
  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