module Scrivito # @api public # # This class represents a collection of meta data attributes. # # == Available meta data attributes # All binaries have the meta attributes +content_length+ and +content_type+, in addition, PDFs # and images have attributes specfic to their type. # # If not specified otherwise, the attributes contain +string+ values. # # [+content_length (Number)+] Size in bytes of the given file. # [+content_type+] MIME-type of the given file. # # == Available meta data attributes for PDFs # # [+text+] Text content of the PDF document. # # == Available meta data attributes for Images # # The meta data attributes starting with +iptc_+ or +exif_+ are extracted from the image itself # and therefore may not be available for every image. +Iptc+ and +exif+ are both standardized # formats supported by a wide array of software and hardware, like cameras and phones. # # [+width (Number)+] Width in pixels. # [+height (Number)+] Height in pixels. # [+exif_copyright+] Copyright of the image. # [+exif_date_time+] The date at which the image was produced. # # [+iptc_keywords (Array)+ ] A list of keywords associated with the image. # [+iptc_headline+] The headline of the image. # [+iptc_copyright+] Copyright of the image. # [+iptc_byline+] The name of the image creator. # [+iptc_credit+] Contains the persons or companies that should be credited. # [+iptc_source+] The original copyright holder. # [+iptc_profile+] The color profile of the image. # [+iptc_city+] The city in which the image was produced. # [+iptc_state+] The state in which the image was produced. # [+iptc_country_name+] The country in which the image was produced. # [+iptc_country_code+] The code of the country in which the image was produced. class MetaDataCollection def initialize(attributes) @attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes) end # @api public # # Find value of a meta data attribute. # # @param name [Symbol, String] the name of the meta data attribute. # @return [String, Array, Fixnum, Date, nil] meta data attribute value if found or +nil+ otherwise. def [](name) @attributes[name] end end end