Class: TwitterCldr::Segmentation::BreakIterator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locale = TwitterCldr.locale, options = {}) ⇒ BreakIterator

Returns a new instance of BreakIterator.


11
12
13
14
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 11

def initialize(locale = TwitterCldr.locale, options = {})
  @locale = locale
  @options = options
end

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale


9
10
11
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 9

def locale
  @locale
end

#optionsObject (readonly)

Returns the value of attribute options


9
10
11
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 9

def options
  @options
end

Instance Method Details

#each_grapheme_cluster(str, &block) ⇒ Object


26
27
28
29
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 26

def each_grapheme_cluster(str, &block)
  iter = iterator_for('grapheme')
  iter.each_segment(str, &block)
end

#each_line(str, &block) ⇒ Object


31
32
33
34
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 31

def each_line(str, &block)
  iter = iterator_for('line')
  iter.each_segment(str, &block)
end

#each_sentence(str, &block) ⇒ Object


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

def each_sentence(str, &block)
  iter = iterator_for('sentence')
  iter.each_segment(str, &block)
end

#each_word(str, &block) ⇒ Object


21
22
23
24
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 21

def each_word(str, &block)
  iter = iterator_for('word')
  iter.each_segment(str, &block)
end