class Restforce::Collection
def count(*args)
def count(*args) # By default, `Enumerable`'s `#count` uses `#each`, which means going through all # of the pages of results, one by one. Instead, we can use `#size` which we have # already overridden to work in a smarter, more efficient way. This only works for # the simple version of `#count` with no arguments. When called with an argument or # a block, you need to know what the items in the collection actually are, so we # call `super` and end up iterating through each item in the collection. return size unless block_given? || !args.empty? super end