@@ -38,7 +38,7 @@ def add_field_expression(field, value)
38
38
raise ArgumentError , "Field must be a string: #{ field } "
39
39
end
40
40
41
- if field [ 0 ] == ?$
41
+ if field . start_with? ( '$' )
42
42
raise ArgumentError , "Field cannot be an operator (i.e. begin with $): #{ field } "
43
43
end
44
44
@@ -48,7 +48,7 @@ def add_field_expression(field, value)
48
48
if value . is_a? ( Hash ) && selector [ field ] . is_a? ( Hash ) &&
49
49
value . keys . all? { |key |
50
50
key_s = key . to_s
51
- key_s [ 0 ] == ?$ && !selector [ field ] . key? ( key_s )
51
+ key_s . start_with? ( '$' ) && !selector [ field ] . key? ( key_s )
52
52
}
53
53
then
54
54
# Multiple operators can be combined on the same field by
@@ -185,7 +185,7 @@ def add_operator_expression(operator, op_expr)
185
185
raise ArgumentError , "Operator must be a string: #{ operator } "
186
186
end
187
187
188
- unless operator [ 0 ] == ?$
188
+ unless operator . start_with? ( '$' )
189
189
raise ArgumentError , "Operator must begin with $: #{ operator } "
190
190
end
191
191
@@ -220,7 +220,7 @@ def add_one_expression(field, value)
220
220
raise ArgumentError , "Field must be a string: #{ field } "
221
221
end
222
222
223
- if field [ 0 ] == ?$
223
+ if field . start_with? ( '$' )
224
224
add_operator_expression ( field , value )
225
225
else
226
226
add_field_expression ( field , value )
0 commit comments