Module: Noodall::Articles::Archive
- Included in:
- ArticleList
- Defined in:
- lib/noodall/articles/archive.rb
Defined Under Namespace
Classes: Year
Instance Method Summary collapse
Instance Method Details
#archive(query = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/noodall/articles/archive.rb', line 4 def archive(query = {}) result = self.collection.map_reduce(archive_map, archive_reduce, {:query => query, :finalize => archive_finalize, :out => "tmp_archives"}) years = result.find.to_a.map{ |hash| Year.new(hash['_id'],hash['value']) }.sort{ |a,b| b.year <=> a.year } years end |