Class: Yt::Models::Iterator

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/yt/models/iterator.rb

Overview

If we dropped support for Ruby 1.9.3, then we could simply use Enumerator which takes a ‘size` parameter in Ruby >= 2.

Instance Method Summary collapse

Constructor Details

#initialize(size = nil, &block) ⇒ Iterator

Returns a new instance of Iterator.



6
7
8
# File 'lib/yt/models/iterator.rb', line 6

def initialize(size=nil, &block)
  RUBY_VERSION < '2' ? super(&block) : super(size, &block)
end

Instance Method Details

#sizeObject



10
11
12
# File 'lib/yt/models/iterator.rb', line 10

def size
  RUBY_VERSION < '2' ? count : super
end