Class: Bitbucket::Collection
- Inherits:
-
Enumerator
- Object
- Enumerator
- Bitbucket::Collection
- Defined in:
- lib/bitbucket/collection.rb
Instance Method Summary collapse
-
#initialize(paginator) ⇒ Collection
constructor
A new instance of Collection.
- #method_missing(method, *args) ⇒ Object
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 |