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.
12 13 14 15 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 12 def initialize(locale = TwitterCldr.locale, = {}) @locale = locale @options = end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
10 11 12 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 10 def locale @locale end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 10 def @options end |
Instance Method Details
#each_grapheme_cluster(str, &block) ⇒ Object
27 28 29 30 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 27 def each_grapheme_cluster(str, &block) raise NotImplementedError, "Grapheme segmentation is not currently supported." end |
#each_line(str, &block) ⇒ Object
32 33 34 35 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 32 def each_line(str, &block) raise NotImplementedError, "Line segmentation is not currently supported." end |
#each_sentence(str, &block) ⇒ Object
17 18 19 20 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 17 def each_sentence(str, &block) rule_set = rule_set_for('sentence') each_boundary(rule_set, str, &block) end |
#each_word(str, &block) ⇒ Object
22 23 24 25 |
# File 'lib/twitter_cldr/segmentation/break_iterator.rb', line 22 def each_word(str, &block) rule_set = rule_set_for('word') each_boundary(rule_set, str, &block) end |