module Masking::Config::TargetColumns::Method::StringBinaryDistinctor

Public Class Methods

new(value) click to toggle source
# File lib/masking/config/target_columns/method/string_binary_distinctor.rb, line 12
def new(value)
  binary?(value) ? Binary.new(value) : String.new(value)
end

Private Class Methods

binary?(string) click to toggle source

NOTE: this is referenced code from standard library

ruby/psych: Rely on encoding tags to determine if string should be dumped as binary
https://github.com/ruby/psych/commit/8949a47b8cee31e03e21608406ba116adcf74054
https://github.com/ruby/psych/issues/278
https://github.com/ruby/psych/blob/e01839af57df559b26f74e906062be6c692c89c8/lib/psych/visitors/yaml_tree.rb#L419-L421
# File lib/masking/config/target_columns/method/string_binary_distinctor.rb, line 23
def binary?(string)
  string.encoding == Encoding::ASCII_8BIT
end