Sha256: 9627bf0747779f70bb69a65b92cf89fbe022463ab60cc5a2c07d78664619ff8d

Contents?: true

Size: 553 Bytes

Versions: 19

Compression:

Stored size: 553 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

module TwitterCldr
  module Segmentation
    class Cursor
      attr_reader :text, :position, :match_cache

      def initialize(text)
        @text = text
        reset
      end

      def advance(amount = 1)
        @position += amount
      end

      def reset
        @position = 0
        @match_cache = {}
      end

      def eof?
        position >= text.size
      end

      def eos?
        position >= text.size - 1
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/lib/twitter_cldr/segmentation/cursor.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-5.1.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-5.0.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.4.5 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.4.4 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.4.3 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.4.2 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.4.1 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.4.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.3.1 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.3.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.2.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.1.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-4.0.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-3.6.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-3.5.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-3.4.0 lib/twitter_cldr/segmentation/cursor.rb
twitter_cldr-3.3.0 lib/twitter_cldr/segmentation/cursor.rb