Class: PragmaticSegmenter::Rule
- Inherits:
-
Struct
- Object
- Struct
- PragmaticSegmenter::Rule
- Defined in:
- lib/pragmatic_segmenter/types.rb
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#replacement ⇒ Object
Returns the value of attribute replacement.
Class Method Summary collapse
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern
4 5 6 |
# File 'lib/pragmatic_segmenter/types.rb', line 4 def pattern @pattern end |
#replacement ⇒ Object
Returns the value of attribute replacement
4 5 6 |
# File 'lib/pragmatic_segmenter/types.rb', line 4 def replacement @replacement end |
Class Method Details
.apply(str, *rules) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/pragmatic_segmenter/types.rb', line 6 def apply(str, *rules) rules.flatten.each do |rule| str.gsub!(rule.pattern, rule.replacement) end str end |