Force the encoding of all string values when setting the instance's values.
# File lib/sequel/plugins/force_encoding.rb, line 49 def _refresh_set_values(values) super(force_hash_encoding(values)) end
Force the encoding of all string values when setting the instance's values.
# File lib/sequel/plugins/force_encoding.rb, line 54 def _save_set_values(values) super(force_hash_encoding(values)) end
Force the encoding for all string values in the given row hash.
# File lib/sequel/plugins/force_encoding.rb, line 59 def force_hash_encoding(row) if fe = model.forced_encoding row.each_value{|v| v.force_encoding(fe) if v.is_a?(String) && !v.is_a?(Sequel::SQL::Blob)} end row end
Force the encoding of all returned strings to the model's forced_encoding.
# File lib/sequel/plugins/force_encoding.rb, line 67 def typecast_value(column, value) s = super if s.is_a?(String) && !s.is_a?(Sequel::SQL::Blob) && (fe = model.forced_encoding) s = s.dup if s.frozen? s.force_encoding(fe) end s end