lib/asana/resource_includes/collection.rb in asana-2.0.1 vs lib/asana/resource_includes/collection.rb in asana-2.0.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require_relative 'response_helper'
module Asana
module Resources
# Public: Represents a paginated collection of Asana resources.
@@ -38,21 +40,19 @@
# Public: Returns the last item in the collection.
def last
@elements.last
end
-
+
# Public: Returns the size of the collection.
def size
to_a.size
end
alias length size
# Public: Returns a String representation of the collection.
def to_s
- "#<Asana::Collection<#{@type}> " \
- "[#{@elements.map(&:inspect).join(', ')}" +
- (@next_page_data ? ', ...' : '') + ']>'
+ "#<Asana::Collection<#{@type}> [#{@elements.map(&:inspect).join(', ')}#{@next_page_data ? ', ...' : ''}]>"
end
alias inspect to_s
# Public: Returns a new Asana::Resources::Collection with the next page
# or nil if there are no more pages. Caches the result.