Allow the force encoding plugin to work with the identity_map plugin by typecasting new values.
# File lib/sequel/plugins/force_encoding.rb, line 41 def merge_db_update(row) super(force_hash_encoding(row)) end
Force the encoding of all string values when setting the instance's values.
# File lib/sequel/plugins/force_encoding.rb, line 46 def set_values(row) super(force_hash_encoding(row)) end
Force the encoding for all string values in the given row hash.
# File lib/sequel/plugins/force_encoding.rb, line 53 def force_hash_encoding(row) fe = model.forced_encoding row.values.each{|v| v.force_encoding(fe) if v.is_a?(String)} if fe row end
Force the encoding of all returned strings to the model's forced_encoding.
# File lib/sequel/plugins/force_encoding.rb, line 60 def typecast_value(column, value) s = super if s.is_a?(String) && (fe = model.forced_encoding) s = s.dup if s.frozen? s.force_encoding(fe) end s end