class ExifTagger::Tag::TagHashOfStrings

Private Instance Methods

validate_hash_items() click to toggle source
# File lib/phtools/exif_tagger/tags/_tag_hash_of_strings.rb, line 13
def validate_hash_items
end
validate_type() click to toggle source
# File lib/phtools/exif_tagger/tags/_tag_hash_of_strings.rb, line 16
def validate_type
  if @value.is_a?(Hash)
    @value.each_value do |val|
      validate_string_size(val)
    end
    unknown_keys = @value.keys - self.class::VALID_KEYS
    unknown_keys.each do |k|
      @errors << %(#{tag_name}: KEY '#{k}' is unknown)
    end
    missed_keys = self.class::VALID_KEYS - @value.keys
    missed_keys.each do |k|
      @errors << %(#{tag_name}: KEY '#{k}' is missed)
    end
    validate_hash_items if @errors.empty?
  else
    @errors << %(#{tag_name}: '#{@value}' is a wrong type \(#{@value.class}\))
  end
  return if @errors.empty?
  @value_invalid << @value
  @value = EMPTY
end