Class: Couchup::Commands::Map

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Couchup::CommandExtensions

included, #needs_db!

Class Method Details

.describe(p = nil) ⇒ Object



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

def self.describe(p = nil)
  {
    :description => "Runs a view with just the map function and returns the results",
    :usage => 'map <view_name> [options]',
    :examples => ["map 'Rider/top_ten'","map 'Rider/top_ten', 10", "map 'Rider/top_ten', {:startkey => '10', :endkey => '20'}","map 'Rider/top_ten', [1,2,3,10]" ]
  }
end

Instance Method Details

#run(*params) ⇒ Object



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

def run(*params)
  needs_db!
  rows = MapReduce.map(*params)
  ap "Found #{rows.size} item(s)"
  ap rows
  rows
end