Class: TwitterCldr::Segmentation::LineIterator

Inherits:
SegmentIterator show all
Defined in:
lib/twitter_cldr/segmentation/line_iterator.rb

Instance Attribute Summary

Attributes inherited from SegmentIterator

#rule_set

Instance Method Summary collapse

Methods inherited from SegmentIterator

#each_segment, #initialize

Constructor Details

This class inherits a constructor from TwitterCldr::Segmentation::SegmentIterator

Instance Method Details

#each_boundary(str, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/twitter_cldr/segmentation/line_iterator.rb', line 9

def each_boundary(str, &block)
  return to_enum(__method__, str) unless block_given?

  # Let the state machine find the first boundary for the line
  # boundary type (i.e. don't yield 0 here). This helps pass
  # nearly all the Unicode segmentation tests, so it must be
  # the right thing to do. Normally the first boundary is the
  # implicit start of text boundary, but potentially not for
  # the line rules?
  cursor = create_cursor(str)
  rule_set.each_boundary(cursor, &block)
end