Class: Couchup::Commands::View
- Inherits:
-
Object
- Object
- Couchup::Commands::View
- Includes:
- Couchup::CommandExtensions
- Defined in:
- lib/couchup/commands/view.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Couchup::CommandExtensions
Class Method Details
.describe(params = nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/couchup/commands/view.rb', line 13 def self.describe(params = nil) { :description => "Executes the given View. Runs Map and Reduce and retuns the results", :usage => "view <view_name> [options]", :examples => ["view 'Riders/top_ten'", "view 'Riders/top_ten', [10,100,200]", "view 'Riders/top_ten', 10", "view 'Riders/top_ten', {:group_level=>2, :group=> true}"] } end |
Instance Method Details
#run(*params) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/couchup/commands/view.rb', line 5 def run(*params) needs_db! rows = MapReduce.reduce(*params) ap "Found #{rows.size} item(s)" ap rows rows end |