lib/crossbeams_responses.rb
# Take validation errors and unwrap Array or Hash.
# Do not call directly. Use +unwrap_failed_response+
#
# @param errs [array,hash] the validation errors for a particular field.
# @return [string] the list of validation errors for the field.
Take validation errors and unwrap Array or Hash.
Do not call directly.
Take validation errors and unwrap Array or Hash . Do not call directly .
def unwrap_errors(errs)
      return errs.join(', ') if errs.is_a?(Array)
      return errs.map { |_, v| unwrap_error_set(v) }.join(' ') if errs.keys.first.is_a?(Integer)
      errs.group_by { |_, v| v }.map { |k, v| ": #{v.map(&:first).join(', ')} #{k.join(', ')}" }.join(', ')
    end
def unwrap_errors ( errs ) return errs . join ( ', ' ) if errs . is_a? ( Array ) return errs . map { | _ , v | unwrap_error_set ( v ) } . join ( ' ' ) if errs . keys . first . is_a? ( Integer ) errs . group_by { | _ , v | v } . map { | k , v | ": #{v.map(&:first).join(', ')} #{k.join(', ')}" } . join ( ', ' ) end
Take validation errors and unwrap Array or Hash.
Take validation errors and unwrap Array or Hash .
# p errs.group_by { |_, v| v } # => {["is missing"]=>[[:no_read, ["is missing"]]]} # errs.group_by { |_, v| v }.map { |k, v| ": #{v.length} item#{v.length == 1 ? '' : 's'} #{k.join(', ')}" }.join(', ')
the list of validation errors for the field.
the list of validation errors for the field .
string
errs
the validation errors for a particular field.
the validation errors for a particular field .