module Erlang::Terms
@private
Constants
- BINARY_ENCODING
- PRINTABLE
- TERM_ORDER
- UINT8_SPLAT
- UTF8_ENCODING
- VERSION
Public Class Methods
binary_encoding(string)
click to toggle source
# File lib/erlang/terms.rb, line 29 def self.binary_encoding(string) string = string.dup if string.frozen? string = string.force_encoding(BINARY_ENCODING) return string end
printable?(string)
click to toggle source
# File lib/erlang/terms.rb, line 35 def self.printable?(string) return !!(PRINTABLE =~ string) end
utf8_encoding(string)
click to toggle source
# File lib/erlang/terms.rb, line 39 def self.utf8_encoding(string) string = string.dup if string.frozen? begin string = string.encode(UTF8_ENCODING) rescue EncodingError string = string.force_encoding(UTF8_ENCODING) end if string.valid_encoding? return true, string else string = binary_encoding(string) return false, string end end