Module: WingedCouch::Native::Databases::Sugar::ClassMethods

Includes:
Enumerable
Defined in:
lib/winged_couch/native/databases/sugar.rb

Overview

Class methods

Instance Method Summary collapse

Instance Method Details

#allArray<WingedCouch::Database>

Returns all databases

Examples:

WingedCouch::Native::Database.all
# => [#<WingedCouch::Native::Database name='_users'>]

Returns:

  • (Array<WingedCouch::Database>)

25
26
27
# File 'lib/winged_couch/native/databases/sugar.rb', line 25

def all
  Server.all_dbs.map { |db_name| self.new(db_name) }
end

#create(name) ⇒ WingedCouch::Database

Creates database in CouchDB and returns it

Parameters:

  • name (String)

    name of database

Returns:

  • (WingedCouch::Database)

Raises:


47
48
49
# File 'lib/winged_couch/native/databases/sugar.rb', line 47

def create(name)
  self.new(name).create
end

#each {|WingedCouch::Native::Database| ... } ⇒ Object

Iterates over all CouchDB database


35
36
37
# File 'lib/winged_couch/native/databases/sugar.rb', line 35

def each(&block)
  all.each(&block)
end