Skip to content

Commit dabeec0

Browse files
committed
Use symbols for method names instead of referring to callstack for efficiency
1 parent c6abea6 commit dabeec0

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/mongo/collection/view/readable.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def allow_partial_results
9292
#
9393
# @since 2.0.0
9494
def batch_size(batch_size = nil)
95-
configure(__method__, batch_size)
95+
configure(:batch_size, batch_size)
9696
end
9797

9898
# Associate a comment with the query.
@@ -110,7 +110,7 @@ def batch_size(batch_size = nil)
110110
#
111111
# @since 2.0.0
112112
def comment(comment = nil)
113-
configure_modifier(__method__, comment)
113+
configure_modifier(:comment, comment)
114114
end
115115

116116
# Get a count of matching documents in the collection.
@@ -178,7 +178,7 @@ def distinct(field_name, options={})
178178
#
179179
# @since 2.0.0
180180
def hint(hint = nil)
181-
configure_modifier(__method__, hint)
181+
configure_modifier(:hint, hint)
182182
end
183183

184184
# The max number of docs to return from the query.
@@ -192,7 +192,7 @@ def hint(hint = nil)
192192
#
193193
# @since 2.0.0
194194
def limit(limit = nil)
195-
configure(__method__, limit)
195+
configure(:limit, limit)
196196
end
197197

198198
# Execute a map/reduce operation on the collection view.
@@ -222,7 +222,7 @@ def map_reduce(map, reduce, options = {})
222222
#
223223
# @since 2.0.0
224224
def max_scan(value = nil)
225-
configure_modifier(__method__, value)
225+
configure_modifier(:max_scan, value)
226226
end
227227

228228
# Set the maximum value to search.
@@ -236,7 +236,7 @@ def max_scan(value = nil)
236236
#
237237
# @since 2.1.0
238238
def max_value(value = nil)
239-
configure_modifier(__method__, value)
239+
configure_modifier(:max_value, value)
240240
end
241241

242242
# Set the minimum value to search.
@@ -250,7 +250,7 @@ def max_value(value = nil)
250250
#
251251
# @since 2.1.0
252252
def min_value(value = nil)
253-
configure_modifier(__method__, value)
253+
configure_modifier(:min_value, value)
254254
end
255255

256256
# The server normally times out idle cursors after an inactivity period
@@ -263,7 +263,7 @@ def min_value(value = nil)
263263
#
264264
# @since 2.0.0
265265
def no_cursor_timeout
266-
configure_flag(__method__)
266+
configure_flag(:no_cursor_timeout)
267267
end
268268

269269
# The fields to include or exclude from each doc in the result set.
@@ -282,7 +282,7 @@ def no_cursor_timeout
282282
# @since 2.0.0
283283
def projection(document = nil)
284284
validate_doc!(document) if document
285-
configure(__method__, document)
285+
configure(:projection, document)
286286
end
287287

288288
# The read preference to use for the query.
@@ -298,7 +298,7 @@ def projection(document = nil)
298298
# @since 2.0.0
299299
def read(value = nil)
300300
return default_read if value.nil?
301-
configure(__method__, value.is_a?(Hash) ? ServerSelector.get(value) : value)
301+
configure(:read, value.is_a?(Hash) ? ServerSelector.get(value) : value)
302302
end
303303

304304
# Set whether to return only the indexed field or fields.
@@ -312,7 +312,7 @@ def read(value = nil)
312312
#
313313
# @since 2.1.0
314314
def return_key(value = nil)
315-
configure_modifier(__method__, value)
315+
configure_modifier(:return_key, value)
316316
end
317317

318318
# Set whether the disk location should be shown for each document.
@@ -327,7 +327,7 @@ def return_key(value = nil)
327327
#
328328
# @since 2.0.0
329329
def show_disk_loc(value = nil)
330-
configure_modifier(__method__, value)
330+
configure_modifier(:show_disk_loc, value)
331331
end
332332

333333
# The number of docs to skip before returning results.
@@ -342,7 +342,7 @@ def show_disk_loc(value = nil)
342342
#
343343
# @since 2.0.0
344344
def skip(number = nil)
345-
configure(__method__, number)
345+
configure(:skip, number)
346346
end
347347

348348
# Set the snapshot value for the view.
@@ -357,7 +357,7 @@ def skip(number = nil)
357357
#
358358
# @since 2.0.0
359359
def snapshot(value = nil)
360-
configure_modifier(__method__, value)
360+
configure_modifier(:snapshot, value)
361361
end
362362

363363
# The key and direction pairs by which the result set will be sorted.
@@ -372,7 +372,7 @@ def snapshot(value = nil)
372372
#
373373
# @since 2.0.0
374374
def sort(spec = nil)
375-
configure_modifier(__method__, spec)
375+
configure_modifier(:sort, spec)
376376
end
377377

378378
# “meta” operators that let you modify the output or behavior of a query.
@@ -387,7 +387,7 @@ def sort(spec = nil)
387387
# @since 2.1.0
388388
def modifiers(doc = nil)
389389
return @modifiers if doc.nil?
390-
new(options.merge(__method__ => doc))
390+
new(options.merge(:modifiers => doc))
391391
end
392392

393393
# A cumulative time limit in milliseconds for processing operations on a cursor.
@@ -401,7 +401,7 @@ def modifiers(doc = nil)
401401
#
402402
# @since 2.1.0
403403
def max_time_ms(max = nil)
404-
configure_modifier(__method__, max)
404+
configure_modifier(:max_time_ms, max)
405405
end
406406

407407
private

0 commit comments

Comments
 (0)