Class: Dir

Inherits:
Object
  • Object
show all
Extended by:
CouchOpen
Defined in:
lib/couchio/core_ext/dir.rb

Class Method Summary collapse

Methods included from CouchOpen

open

Class Method Details

.couch_orig_entriesObject



7
# File 'lib/couchio/core_ext/dir.rb', line 7

alias couch_orig_entries entries

.couch_orig_foreachObject



16
# File 'lib/couchio/core_ext/dir.rb', line 16

alias couch_orig_foreach foreach

.couch_orig_mkdirObject



36
# File 'lib/couchio/core_ext/dir.rb', line 36

alias couch_orig_mkdir mkdir

.couch_orig_rmdirObject



25
# File 'lib/couchio/core_ext/dir.rb', line 25

alias couch_orig_rmdir rmdir

.entries(dirname) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/couchio/core_ext/dir.rb', line 8

def entries(dirname)
  if dirname.index("couch://") == 0
    CouchDatabase.new(dirname).map
  else
    couch_orig_entries(dirname)
  end
end

.foreach(dirname, &block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/couchio/core_ext/dir.rb', line 17

def foreach(dirname, &block)
  if dirname.index("couch://") == 0
    CouchDatabase.new(dirname).each {|f| yield f }
  else
    couch_orig_foreach(dirname, &block)
  end
end

.mkdir(dirname, *args) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/couchio/core_ext/dir.rb', line 37

def mkdir(dirname, *args)
  if dirname.index("couch://") == 0
    CouchDatabase.new(dirname).create
  else
    couch_orig_mkdir(dirname, *args)
  end
end

.rmdir(dirname) ⇒ Object Also known as: unlink, delete



26
27
28
29
30
31
32
# File 'lib/couchio/core_ext/dir.rb', line 26

def rmdir(dirname)
  if dirname.index("couch://") == 0
    CouchDatabase.new(dirname).delete
  else
    couch_orig_rmdir(dirname)
  end
end