class Prolog::Services::ReplaceContent::Splitter::Symmetric::Parts
Simplemindedly splits content string based on endpoints, returning bounding segments (not including substring within endpoints). Nobody should care what the marker actually is; just that it wrapps the `inner` value and makes the combination unique within the content.
Public Class Methods
_marker()
click to toggle source
# File lib/prolog/services/replace_content/splitter/symmetric.rb, line 34 def self._marker 'z|q|x' * 8 end
_split(working, endpoints)
click to toggle source
# File lib/prolog/services/replace_content/splitter/symmetric.rb, line 38 def self._split(working, endpoints) marker = _marker working[endpoints] = marker working.split marker end
_twiddle(items)
click to toggle source
# File lib/prolog/services/replace_content/splitter/symmetric.rb, line 44 def self._twiddle(items) return ['', ''] if items.empty? items end
parts(content, endpoints)
click to toggle source
# File lib/prolog/services/replace_content/splitter/symmetric.rb, line 30 def self.parts(content, endpoints) _twiddle(_split(content.dup, endpoints)) end