class BigResources::PictureFileType

Public Class Methods

is_type(file_name,type) click to toggle source
# File lib/big_resources/model/file_type.rb, line 20
def self.is_type(file_name,type)
  PictureFileType.each do | type |
    regexStr = "^[\w-]+(\.#{type})$"
    regex = Regex.create(regexStr)
    if regex =~ file_name
    end
  end
  # if file_name ~= /.*[.png]$/
  #   PNG
  # elsif file_name  ~= /.*[.pdf]$/
  #   PDF
  # elsif file_name  ~= /.*[.png]$/
  #   JPG
  # elsif file_name  ~= /$.jpeg/
  #   JPEG
  # elsif file_name  ~= /$.bmp/
  #   BMP
  # else
  #   UNKNOWN
  # end
end
type_name(type) click to toggle source
# File lib/big_resources/model/file_type.rb, line 42
def self.type_name(type)
  if type == PNG
    ".png"
  elsif type == PDF
    ".pdf"
  elsif type == JPG
    ".jpg"
  elsif type == JPEG
    ".jpeg"
  elsif type == BMP
    ".bmp"
  end
end

Public Instance Methods

each() { |PNG| ... } click to toggle source
# File lib/big_resources/model/file_type.rb, line 12
def each
  yield PNG
  yield PDF
  yield JPG
  yield JPEG
  yield BMP
end