Permalink
Browse files

Whitespace. Formatting. Non-destructive :sort.

  • Loading branch information...
1 parent 7470be0 commit 810ad61db83c4687149fa66b5d25aa4b4aaea077 @jnunemaker jnunemaker committed Mar 18, 2011
Showing with 8 additions and 10 deletions.
  1. +8 −10 lib/plucky/query.rb
View
@@ -109,22 +109,22 @@ def update(opts={})
def fields(*args)
clone.tap { |query| query.options[:fields] = *args }
end
-
+
def ignore(*args)
- set_fields(args,0)
+ set_fields(args, 0)
end
-
+
def only(*args)
- set_fields(args,1)
- end
+ set_fields(args, 1)
+ end
def limit(count=nil)
clone.tap { |query| query.options[:limit] = count }
end
def reverse
clone.tap do |query|
- query[:sort].map! do |s|
+ query[:sort] = query[:sort].map do |s|
[s[0], -s[1]]
end unless query.options[:sort].nil?
end
@@ -197,14 +197,12 @@ def inspect
end.sort.join(",")
"#<#{self.class}#{as_nice_string}>"
end
-
- private
-
+
+ private
def set_fields(field_list, value)
the_fields = {}
field_list.each {|field| the_fields[field.to_sym] = value}
clone.tap { |query| query.options[:fields] = the_fields}
end
-
end
end

0 comments on commit 810ad61

Please sign in to comment.