Permalink
Browse files

more symbol monkeypatching: support for #asc, #desc and #in

  • Loading branch information...
1 parent c74901c commit 33569a0539613f2a43f8d6201d50a5cced5f83fa @tmm1 committed Aug 2, 2008
Showing with 20 additions and 9 deletions.
  1. +20 −9 rmongo.rb
View
@@ -173,18 +173,29 @@ def send(command_id, &cb)
# XXX this is terrible, yes i know!
class Symbol
- {
- :< => :$lt,
+ { :< => :$lt,
:<= => :$lte,
:> => :$gt,
- :>= => :$gte
- }.each do |func, key|
- class_eval %[
- def #{func} num
- { self => { :#{key} => num }}
- end
- ]
+ :>= => :$gte }.each do |func, key|
+ class_eval %[
+ def #{func} num
+ { self => { :#{key} => num }}
+ end
+ ]
+ end
+
+ def in values
+ { self => { :$in => values }}
+ end
+
+ def asc
+ { self => 1 }
end
+
+ def desc
+ { self => -1 }
+ end
+
end
EM.run{

0 comments on commit 33569a0

Please sign in to comment.