debian-mirror-gitlab/lib/bitbucket/collection.rb

24 lines
503 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module Bitbucket
class Collection < Enumerator
def initialize(paginator)
super() do |yielder|
loop do
paginator.items.each { |item| yielder << item }
end
end
lazy
end
def method_missing(method, *args)
return super unless self.respond_to?(method)
2018-03-17 18:26:18 +05:30
self.__send__(method, *args) do |item| # rubocop:disable GitlabSecurity/PublicSend
2017-08-17 22:00:37 +05:30
block_given? ? yield(item) : item
end
end
end
end