Class: TwitterCldr::Segmentation::BreakIterator
- Inherits:
-
Object
- Object
- TwitterCldr::Segmentation::BreakIterator
- Defined in:
- lib/twitter_cldr/segmentation/break_iterator.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #each_grapheme_cluster(str, &block) ⇒ Object
- #each_line(str, &block) ⇒ Object
- #each_sentence(str, &block) ⇒ Object
- #each_word(str, &block) ⇒ Object
-
#initialize(locale = TwitterCldr.locale, options = {}) ⇒ BreakIterator
constructor
A new instance of BreakIterator.
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, = {}) @locale = locale @options = end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
9 10 11 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 9 def locale @locale end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 9 def @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 |