lib/timeliness/definitions.rb
def add_formats(type, *add_formats)
        formats = send("#{type}_formats")
        options = add_formats.last.is_a?(Hash) ? add_formats.pop : {}
        before  = options[:before]
        raise FormatNotFound, "Format for :before option #{before.inspect} was not found." if before && !formats.include?(before)

        add_formats.each do |format|
          raise DuplicateFormat, "Format #{format.inspect} is already included in #{type.inspect} formats" if formats.include?(format)

          index = before ? formats.index(before) : -1
          formats.insert(index, format)
        end
        compile_formats
      end
# Adds new formats. Must specify format type and can specify a :before
# option to nominate which format the new formats should be inserted in
# front on to take higher precedence.
#
# Error is raised if format already exists or if :before format is not found.
#
Adds new formats. Must specify format type and can specify a :before
option to nominate which format the new formats should be inserted in
front on to take higher precedence.

Error is raised if format already exists or if :before format is not found.
Adds new formats . Must specify format type and can specify a : before option to nominate which format the new formats should be inserted in front on to take higher precedence . Error is raised if format already exists or if : before format is not found .
def add_formats(type, *add_formats)
        formats = send("#{type}_formats")
        options = add_formats.last.is_a?(Hash) ? add_formats.pop : {}
        before  = options[:before]
        raise FormatNotFound, "Format for :before option #{before.inspect} was not found." if before && !formats.include?(before)
        add_formats.each do |format|
          raise DuplicateFormat, "Format #{format.inspect} is already included in #{type.inspect} formats" if formats.include?(format)
          index = before ? formats.index(before) : -1
          formats.insert(index, format)
        end
        compile_formats
      end
def add_formats ( type , * add_formats ) formats = send ( "#{type}_formats" ) options = add_formats . last . is_a? ( Hash ) ? add_formats . pop : { } before = options [ :before ] raise FormatNotFound , "Format for :before option #{before.inspect} was not found." if before && ! formats . include? ( before ) add_formats . each do | format | raise DuplicateFormat , "Format #{format.inspect} is already included in #{type.inspect} formats" if formats . include? ( format ) index = before ? formats . index ( before ) : - 1 formats . insert ( index , format ) end compile_formats end
Adds new formats.
Adds new formats .
type
add_formats