/usr/lib/ruby/vendor_ruby/sequel/plugins/string_stripper.rb is in ruby-sequel 3.33.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | module Sequel
module Plugins
# StringStripper is a very simple plugin that strips all input strings
# when assigning to the model's values. Example:
#
# album = Album.new(:name=>' A ')
# album.name # => 'A'
#
# Usage:
#
# # Make all model subclass instances strip strings (called before loading subclasses)
# Sequel::Model.plugin :string_stripper
#
# # Make the Album class strip strings
# Album.plugin :string_stripper
module StringStripper
module InstanceMethods
# Strip value if it is a string, before attempting to assign
# it to the model's values.
def []=(k, v)
v.is_a?(String) ? super(k, v.strip) : super
end
end
end
end
end
|