Class: TwitterCldr::Segmentation::PossibleWordList

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/segmentation/possible_word_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(length) ⇒ PossibleWordList

Returns a new instance of PossibleWordList.



12
13
14
15
# File 'lib/twitter_cldr/segmentation/possible_word_list.rb', line 12

def initialize(length)
  @items = Array.new(length) { PossibleWord.new }
  @length = length
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



10
11
12
# File 'lib/twitter_cldr/segmentation/possible_word_list.rb', line 10

def items
  @items
end

#lengthObject (readonly)

Returns the value of attribute length.



10
11
12
# File 'lib/twitter_cldr/segmentation/possible_word_list.rb', line 10

def length
  @length
end

Instance Method Details

#[](idx) ⇒ Object



17
18
19
# File 'lib/twitter_cldr/segmentation/possible_word_list.rb', line 17

def [](idx)
  items[idx % length]
end