Class: TwitterCldr::Segmentation::RuleSet
- Inherits:
-
Object
- Object
- TwitterCldr::Segmentation::RuleSet
- Defined in:
- lib/twitter_cldr/segmentation/rule_set.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#state_machine ⇒ Object
readonly
Returns the value of attribute state_machine.
-
#use_uli_exceptions ⇒ Object
(also: #use_uli_exceptions?)
Returns the value of attribute use_uli_exceptions.
Class Method Summary collapse
Instance Method Summary collapse
- #boundary_type ⇒ Object
- #each_boundary(cursor, stop = cursor.length) ⇒ Object
-
#initialize(locale, state_machine, options) ⇒ RuleSet
constructor
A new instance of RuleSet.
Constructor Details
#initialize(locale, state_machine, options) ⇒ RuleSet
Returns a new instance of RuleSet.
21 22 23 24 25 26 27 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 21 def initialize(locale, state_machine, ) @locale = locale @state_machine = state_machine @use_uli_exceptions = .fetch( :use_uli_exceptions, false ) end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
16 17 18 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 16 def locale @locale end |
#state_machine ⇒ Object (readonly)
Returns the value of attribute state_machine.
16 17 18 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 16 def state_machine @state_machine end |
#use_uli_exceptions ⇒ Object Also known as: use_uli_exceptions?
Returns the value of attribute use_uli_exceptions.
17 18 19 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 17 def use_uli_exceptions @use_uli_exceptions end |
Class Method Details
.create(locale, boundary_type, options = {}) ⇒ Object
11 12 13 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 11 def create(locale, boundary_type, = {}) new(locale, StateMachine.instance(boundary_type, locale), ) end |
Instance Method Details
#boundary_type ⇒ Object
38 39 40 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 38 def boundary_type state_machine.boundary_type end |
#each_boundary(cursor, stop = cursor.length) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/twitter_cldr/segmentation/rule_set.rb', line 29 def each_boundary(cursor, stop = cursor.length) return to_enum(__method__, cursor, stop) unless block_given? until cursor.position >= stop || cursor.eos? state_machine.handle_next(cursor) yield cursor.position if cursor.eos? || suppressions.should_break?(cursor) end end |