diff options
Diffstat (limited to 'lib/bitbucket_server/collection.rb')
-rw-r--r-- | lib/bitbucket_server/collection.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bitbucket_server/collection.rb b/lib/bitbucket_server/collection.rb new file mode 100644 index 00000000000..1f199c99854 --- /dev/null +++ b/lib/bitbucket_server/collection.rb @@ -0,0 +1,21 @@ +module BitbucketServer + 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) + + self.__send__(method, *args) do |item| # rubocop:disable GitlabSecurity/PublicSend + block_given? ? yield(item) : item + end + end + end +end |