Method: ExistAPI#existscollection?
- Defined in:
- lib/eXistAPI.rb
#existscollection?(orig_path) ⇒ Boolean
Checks if collection with path exists or not.
-
Args :
-
path-> Path of the collection in db.
-
-
Returns : -boolean. true -> exists, false -> doesn’t exist
-
Raises :
-
nothing
-
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/eXistAPI.rb', line 138 def existscollection?(orig_path) orig_path = check_slashes(orig_path) collections = orig_path.split("/") collections.delete("") i=0 path = "/" while(i < collections.length) path = path + collections[i] + "/" col = Collection.new(@client, path) if (!col.childCollection.include?(collections[i+1])) break end i = i + 1 end if(path[-1]=="/") path = path[0..-2] end if(orig_path[-1]=="/") orig_path = orig_path[0..-2] end if(path == orig_path) return true else return false end rescue => e raise e end |