class LHS::Problems::Warnings

Public Class Methods

new(raw, record = nil) click to toggle source
# File lib/lhs/problems/warnings.rb, line 6
def initialize(raw, record = nil)
  @raw = raw
  @record = record
  @codes = {}.with_indifferent_access
  @messages = warnings_from_raw
end

Private Instance Methods

warnings_from_raw() click to toggle source
# File lib/lhs/problems/warnings.rb, line 15
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