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