Class: Couchup::Commands::Get

Inherits:
Object
  • Object
show all
Includes:
Couchup::CommandExtensions
Defined in:
lib/couchup/commands/get.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Couchup::CommandExtensions

included, #needs_db!

Class Method Details

.describeObject



12
13
14
15
16
17
18
19
# File 'lib/couchup/commands/get.rb', line 12

def self.describe
  {
    :description => "Retrives documents from the current database",
    :usage  => "get [:doc], [<id>]",
    :examples => ["get :doc, '2a663b5936f98fe225d64fcaa89e3281'", "get"]
  }
  
end

Instance Method Details

#run(id = nil) ⇒ Object



5
6
7
8
9
10
# File 'lib/couchup/commands/get.rb', line 5

def run(id = nil)
  needs_db!
  match = id.nil? ? Couchup.all.collect{|c| c["doc"]} : Couchup.get(id) 
  ap match
  match
end