Welcome to mirror list, hosted at ThFree Co, Russian Federation.

collection.rb « bitbucket_server « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b50c5dde352a1f5ecbd42836a229b09e8f14f47a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

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