Class: ZeroWidthCharacterEncoder

Inherits:
Object
  • Object
show all
Defined in:
lib/tolgee_liquid/zero_width_character_encoder.rb

Constant Summary collapse

INVISIBLE_CHARACTERS =
["\u200C", "\u200D"].freeze

Instance Method Summary collapse

Instance Method Details

#execute(text) ⇒ Object



4
5
6
7
8
# File 'lib/tolgee_liquid/zero_width_character_encoder.rb', line 4

def execute(text)
  bytes = text.bytes
  binary = bytes.map { |byte| to_binary_with_extra_non_join_character(byte) }.join
  to_invisible_string(binary)
end