Class: TwitterCldr::Parsers::SegmentationParser::NoBreakRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/twitter_cldr/parsers/segmentation_parser.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#id, #string

Instance Method Summary collapse

Constructor Details

#initialize(regex) ⇒ NoBreakRule

Returns a new instance of NoBreakRule.



53
54
55
# File 'lib/twitter_cldr/parsers/segmentation_parser.rb', line 53

def initialize(regex)
  @regex = regex
end

Instance Attribute Details

#regexObject (readonly)

Returns the value of attribute regex.



51
52
53
# File 'lib/twitter_cldr/parsers/segmentation_parser.rb', line 51

def regex
  @regex
end

Instance Method Details

#boundary_symbolObject



63
64
65
# File 'lib/twitter_cldr/parsers/segmentation_parser.rb', line 63

def boundary_symbol
  :no_break
end

#match(str) ⇒ Object



57
58
59
60
61
# File 'lib/twitter_cldr/parsers/segmentation_parser.rb', line 57

def match(str)
  if match = regex.match(str)
    RuleMatchData.new(match[0], match.offset(0).last)
  end
end