Class: Decidim::SpamDetection::CommandErrors
- Inherits:
-
Hash
- Object
- Hash
- Decidim::SpamDetection::CommandErrors
- Defined in:
- lib/decidim/spam_detection/command_errors.rb
Instance Method Summary collapse
- #add(key, value, _opts = {}) ⇒ Object
- #add_multiple_errors(errors_hash) ⇒ Object
- #each ⇒ Object
- #full_messages ⇒ Object
Instance Method Details
#add(key, value, _opts = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/decidim/spam_detection/command_errors.rb', line 6 def add(key, value, _opts = {}) self[key] ||= [] self[key] << value self[key].uniq! end |
#add_multiple_errors(errors_hash) ⇒ Object
12 13 14 15 16 |
# File 'lib/decidim/spam_detection/command_errors.rb', line 12 def add_multiple_errors(errors_hash) errors_hash.each do |key, values| values.each { |value| add key, value } end end |
#each ⇒ Object
18 19 20 21 22 |
# File 'lib/decidim/spam_detection/command_errors.rb', line 18 def each each_key do |field| self[field].each { || yield field, } end end |
#full_messages ⇒ Object
24 25 26 |
# File 'lib/decidim/spam_detection/command_errors.rb', line 24 def map { |attribute, | (attribute, ) } end |