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.



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

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

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale.



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

def locale
  @locale
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#each_grapheme_cluster(str, &block) ⇒ Object

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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