summaryrefslogtreecommitdiff
path: root/core/lib/extensions
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-22 15:51:24 +0100
committerAzul <azul@leap.se>2012-12-22 15:51:24 +0100
commit04376c286daee0165f6544ecdafaa645aa7695c0 (patch)
treed17da06435217eb78cfcb1867efe5ec9d868c22a /core/lib/extensions
parent9a23a5d63b2b5bcb1994137a5de9f8ebd88142f1 (diff)
moving the js for view definitions into separate files
This way we get syntax highlighting and so on.
Diffstat (limited to 'core/lib/extensions')
-rw-r--r--core/lib/extensions/couchrest.rb25
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