Class: Bitbucket::Collection

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/bitbucket/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(paginator) ⇒ Collection

Returns a new instance of Collection.


5
6
7
8
9
10
11
12
13
# File 'lib/bitbucket/collection.rb', line 5

def initialize(paginator)
  super() do |yielder|
    loop do
      paginator.items.each { |item| yielder << item }
    end
  end

  lazy
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object


15
16
17
18
19
20
21
# File 'lib/bitbucket/collection.rb', line 15

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