Sha256: a54755ffce157a88a54c014f20b81c33731156d2f3d1830b90bde4d2ab69e5c2

Contents?: true

Size: 499 Bytes

Versions: 8

Compression:

Stored size: 499 Bytes

Contents

module Hiccup
  module Inferable
    class DatesEnumerator

      def initialize(dates)
        @dates = dates
        @last_index = @dates.length - 1
        @index = -1
      end

      attr_reader :index

      def done?
        @index == @last_index
      end

      def next
        @index += 1
        raise OutOfRangeException if @index > @last_index
        @dates[@index]
      end

      def rewind_by(n)
        @index -= n
        @index = -1 if @index < -1
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hiccup-0.6.1 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.6.0 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.20 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.19 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.18 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.17 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.16 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.15 lib/hiccup/inferable/dates_enumerator.rb