Sha256: f6e0bb27ca9377d5e702aa42f8a7836df1ab11eef65c409a39d758e6242ff077

Contents?: true

Size: 581 Bytes

Versions: 12

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module DHS::Problems
  class Warnings < Base

    def initialize(raw, record = nil)
      @raw = raw
      @record = record
      @codes = {}.with_indifferent_access
      @messages = warnings_from_raw
    end

    private

    def warnings_from_raw
      messages = {}
      return messages if !raw.is_a?(Hash) || raw[:field_warnings].blank?
      raw[:field_warnings].each do |field_warning|
        add_error(messages, field_warning[:path].join('.').to_sym, field_warning[:code])
      end
      messages.with_indifferent_access
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/problems/warnings.rb
dhs-1.5.0 lib/dhs/problems/warnings.rb
dhs-1.4.2 lib/dhs/problems/warnings.rb
dhs-1.4.1 lib/dhs/problems/warnings.rb
dhs-1.4.0 lib/dhs/problems/warnings.rb
dhs-1.3.0 lib/dhs/problems/warnings.rb
dhs-1.2.0 lib/dhs/problems/warnings.rb
dhs-1.1.0 lib/dhs/problems/warnings.rb
dhs-1.0.3 lib/dhs/problems/warnings.rb
dhs-1.0.2 lib/dhs/problems/warnings.rb
dhs-1.0.1 lib/dhs/problems/warnings.rb
dhs-1.0.0 lib/dhs/problems/warnings.rb