# File formvalidator.rb, line 601 def apply_hash_constraint(key, constraint) name = constraint["name"] action = constraint["constraint"] params = constraint["params"] res = false # In order to call a builtin or proc, params and action must be present. if action and params arg = params.map {|m| @form[m]} if String === action res = self.send("match_#{action}".intern, *arg) elsif Proc === action res = action.call(*arg) end end if Regexp === action # FIXME: multiple elements m = action.match(@form[key].to_s) res = m[0] if m end if res @form[key] = res if untaint?(key) else @form.delete(key) constraint = (name) ? name : constraint @invalid_fields[key] ||= [] unless @invalid_fields[key].include?(constraint) @invalid_fields[key].push(constraint) end nil end end