Sha256: 1042efa117f50ad6a1748ef496cc741ab44ba0b7a1f8c9b1259a2b535c468fc1

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

module Sastrawi
  module Dictionary
    class ArrayDictionary
      attr_accessor :words

      def initialize(words = [])
        @words = []

        add_words(words)
      end

      def contains?(word)
        @words.include?(word)
      end

      def count
        @words.length
      end

      def add_words(new_words)
        new_words.each do |word|
          add(word)
        end
      end

      def add(word)
        return if word == ''

        @words.push(word)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sastrawi-0.1.0.pre lib/sastrawi/dictionary/array_dictionary.rb