Sha256: de0dcb19486f3d1d921131e41019603e76bd9c02be2f392c77a7250422e082c5
Contents?: true
Size: 751 Bytes
Versions: 2
Compression:
Stored size: 751 Bytes
Contents
# frozen_string_literal: true # (c) Copyright 2020 Ribose Inc. # module IEV module DataConversions refine String do def decode_html! replace(decode_html) nil end def decode_html HTMLEntities.new(:expanded).decode(self) end # Normalize various encoding anomalies like `\uFEFF` in strings def sanitize! unicode_normalize! gsub!("\uFEFF", "") gsub!("\u2011", "-") gsub!("\u00a0", " ") gsub!(/[\u2000-\u2006]/, " ") strip! nil end # @see sanitize! def sanitize dup.tap(&:sanitize!) end def to_three_char_code IEV::Iso639Code.three_char_code(self).first end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iev-0.3.4 | lib/iev/data_conversions.rb |
iev-0.3.3 | lib/iev/data_conversions.rb |