Method: Tiff::Tag#serialize

Defined in:
lib/tiff/tag.rb

#serialize(value) ⇒ Object

Returns the value for serialization. If the tag does not have a map defined, this simply returns the value provided.

If a map was provided for the tag, it will return the value for the mapping. If the mapping isn’t found, it will raise an exception.



45
46
47
48
49
50
51
# File 'lib/tiff/tag.rb', line 45

def serialize(value)
  return value unless map

  map.fetch value do
    raise KeyError, "Tag #{name.inspect} does not support value #{value.inspect}. Defined values: #{map.keys}"
  end
end