module DyiRails

Root namespace of “DYI for Rails”. @since 0.0.0

Copyright © 2009-2012 Sound-F Co., Ltd. All rights reserved.

Author

Mamoru Yuo

This file is part of “DYI for Rails”.

“DYI for Rails” is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

“DYI for Rails” is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with “DYI for Rails”. If not, see <www.gnu.org/licenses/>.

Copyright © 2009-2012 Sound-F Co., Ltd. All rights reserved.

Author

Mamoru Yuo

This file is part of “DYI for Rails”.

“DYI for Rails” is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

“DYI for Rails” is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with “DYI for Rails”. If not, see <www.gnu.org/licenses/>.

Constants

MIME_TYPE

The correspondence of the image format to the mime-type

URL

URL of “DYI for Rails” Project

VERSION

“DYI for Rails” program version

Public Class Methods

mime_type(format) click to toggle source

Returns mime-type which the given image format corresponds to. @param [Symbol, String] format image format @return [String] mime-type which the image format corresponds to @raise [ArgumentError] unknown format is given

# File lib/dyi_rails.rb, line 51
def mime_type(format)
  format = format.to_sym
  unless MIME_TYPE.has_key?(format)
    raise ArgumentError, "`#{options[:format]}' is unknown format"
  end
  return MIME_TYPE[format]
end
register_mime_type(format, mime_type) click to toggle source

Registers new correspondence of the image format to mime-type. When the image format has already registered, mime-type is overriden. @param [Symbol, String] format image format @param [String] mime_type mime-type which the image format corresponds to

# File lib/dyi_rails.rb, line 43
def register_mime_type(format, mime_type)
  MIME_TYPE[format.to_sym] = mime_type.to_s
end