diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-11 09:21:12 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-11 09:21:12 +0300 |
commit | bb98ed112c509c6265ba4dff81d7987c52a8748c (patch) | |
tree | b1d85b9821bf6b213744884923841840b4930a21 /lib/bitbucket_server | |
parent | 0936bff496a6e0a8615a56ddca6270e44202587a (diff) |
Add missing file
Diffstat (limited to 'lib/bitbucket_server')
-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 |