Sha256: c7391af80f9617529668cefb4b1d9bb411f3ca3355379c7a7b311ca5a505dd99

Contents?: true

Size: 535 Bytes

Versions: 17

Compression:

Stored size: 535 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

17 entries across 17 versions & 1 rubygems

Version Path
hiccup-0.5.14 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.13 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.12 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.11 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.10 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.9 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.8 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.7 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.6 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.5 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.4 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.3 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.2 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.1 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.5.0 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.4.5 lib/hiccup/inferable/dates_enumerator.rb
hiccup-0.4.4 lib/hiccup/inferable/dates_enumerator.rb