31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/html_terminator.rb', line 31
def terminate_html(*args)
unless method_defined?(:html_terminator_fields)
class_attribute :html_terminator_fields
self.html_terminator_fields = {}
end
options = args.
options = SANITIZE_OPTIONS.clone.merge(options)
args.each do |field|
self.html_terminator_fields[field] = options.deep_dup
end
unless self.html_terminator_fields.empty?
before_validation :terminate_html
args.each do |attr|
define_method(attr) do |*rargs|
HtmlTerminator.sanitize super(*rargs), options
end
end
end
end
|