Sha256: 06ad555824360f59193c7dcab1bc343fee18429d14e044cd1c51cdfe231d853b

Contents?: true

Size: 682 Bytes

Versions: 4

Compression:

Stored size: 682 Bytes

Contents

module IndonesianStemmer
  module StemmerUtility

    def self.included(receiver)
      receiver.send :include, InstanceMethods
    end

    module InstanceMethods
      def starts_with?(text, by_text_size, prefix)
        return false if prefix.size > by_text_size
        prefix.size.times do |i|
          return false if text[i] != prefix[i]
        end
        return true
      end

      def ends_with?(text, by_text_size, suffix)
        suffix_size = suffix.size
        return false if suffix_size > by_text_size
        suffix_size.times do |i|
          return false if text[0 - (suffix_size - i)] != suffix[i]
        end
        return true
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
indonesian_stemmer-0.2.0 lib/indonesian_stemmer/stemmer_utility.rb
indonesian_stemmer-0.1.1 lib/indonesian_stemmer/stemmer_utility.rb
indonesian_stemmer-0.1.0 lib/indonesian_stemmer/stemmer_utility.rb
indonesian_stemmer-0.0.1 lib/indonesian_stemmer/stemmer_utility.rb