Module: ExistDB::Resource

Defined in:
lib/existdb/resource/xml.rb,
lib/existdb/resource/base.rb,
lib/existdb/resource/binary.rb

Defined Under Namespace

Classes: Base, Binary, Xml

Class Method Summary collapse

Class Method Details

.new(*options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/existdb/resource/base.rb', line 5

def new(*options)
    if options.size == 1 and not options.first.is_a?(Hash) then
        obj = options.first
        ClassWrap[obj]
    else
        if options.any?{|opt| opt.is_a?(Hash) && ( opt[:xml] || opt[:type] == 'XMLResource' ) } then
            Xml.new(*options)
        elsif options.any?{|opt| opt.is_a?(Hash) && ( opt[:binary] || opt[:type] == 'BinaryResource' ) } then
            Binary.new(*options)
        end
    end
end