Module: EPUB::CFI
- Defined in:
- lib/epub/cfi.rb
Defined Under Namespace
Classes: CharacterOffset, IDAssertion, Location, Path, Range, Step, TemporalSpatialOffset, TextLocationAssertion
Constant Summary collapse
- SPECIAL_CHARS =
“5E”, “5B”, “5D”, “28”, “29”, “2C”, “3B”, “3D”
'^[](),;='
- RE_ESCAPED_SPECIAL_CHARS =
Regexp.escape(SPECIAL_CHARS)
Class Method Summary collapse
Class Method Details
.escape(string) ⇒ Object
7 8 9 |
# File 'lib/epub/cfi.rb', line 7 def escape(string) string.gsub(/([#{RE_ESCAPED_SPECIAL_CHARS}])/o, '^\1') end |
.unescape(string) ⇒ Object
11 12 13 |
# File 'lib/epub/cfi.rb', line 11 def unescape(string) string.gsub(/\^([#{RE_ESCAPED_SPECIAL_CHARS}])/o, '\1') end |