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+, +content_type+ and +filename+, in # addition, PDFs and images have attributes specific 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. # [+filename+] The file basename, including the file extension. # # == 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. # # == Searching for meta data # # Meta data is taken into account when searching. See the # {Scrivito::ObjSearchEnumerator ObjSearchEnumerator} for details. # # @example Search for all JPEGs # Image.where('blob:content_type', :equals, 'image/jpeg') # # @example Search for wide images # Image.where('blob:width', :is_greater_than, 1024) 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, Integer, Date, nil] meta data attribute value if # found or +nil+ otherwise. def [](name) @attributes[name] end end end