diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/lib/extensions/couchrest.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb index a8da23b..0dca632 100644 --- a/core/lib/extensions/couchrest.rb +++ b/core/lib/extensions/couchrest.rb @@ -1,8 +1,21 @@ -class CouchRest::Model::Designs::View - - # so we can called Ticket.method.descending or Ticket.method.ascending - def ascending - self - end +module CouchRest::Model::Designs + + class View + + # so we can called Ticket.method.descending or Ticket.method.ascending + def ascending + self + end + end + + class DesignMapper + def load_views(dir) + Dir.glob("#{dir}/*.js") do |js| + name = File.basename(js, '.js') + file = File.open(js, 'r') + view name.to_sym, :map => file.read + end + end + end end |