lib/ncmb/query.rb in ncmb-ruby-client-0.1.3 vs lib/ncmb/query.rb in ncmb-ruby-client-0.1.4
- old
+ new
@@ -1,21 +1,23 @@
+# frozen_string_literal: true
+
module NCMB
module Query
[
- {greaterThan: "$gt"},
- {notEqualTo: "$ne"},
+ {greaterThan: '$gt'},
+ {notEqualTo: '$ne'},
{equalTo: nil},
- {lessThan: "$lt"},
- {lessThanOrEqualTo: "$lte"},
- {greaterThanOrEqualTo: "$gte"},
- {in: "$in"},
- {notIn: "$nin"},
- {exists: "$exists"},
- {regex: "$regex"},
- {inArray: "$inArray"},
- {notInArray: "$ninArray"},
- {allInArray: "$all"},
+ {lessThan: '$lt'},
+ {lessThanOrEqualTo: '$lte'},
+ {greaterThanOrEqualTo: '$gte'},
+ {in: '$in'},
+ {notIn: '$nin'},
+ {exists: '$exists'},
+ {regex: '$regex'},
+ {inArray: '$inArray'},
+ {notInArray: '$ninArray'},
+ {allInArray: '$all'},
].each do |m|
define_method m.keys.first do |name, value|
params = {}
if m.values.first.nil?
params[name] = value
@@ -27,29 +29,29 @@
self
end
end
[
- {withinKilometers: "$maxDistanceInKilometers"},
- {withinMiles: "$maxDistanceInMiles"},
- {withinRadians: "$maxDistanceInRadians"}
+ {withinKilometers: '$maxDistanceInKilometers'},
+ {withinMiles: '$maxDistanceInMiles'},
+ {withinRadians: '$maxDistanceInRadians'}
].each do |m|
define_method m.keys.first do |name, geo, value|
params = {}
params[name] = {
- "$nearSphere": geo,
+ '$nearSphere': geo,
}
params[name][m.values.first] = value
@queries[@search_key] << params
self
end
end
def withinSquare(name, geo1, geo2)
params = {}
params[name] = {
- "$within": {
- "$box": [
+ '$within': {
+ '$box': [
geo1,
geo2
]
}
}