Class: BigResources::PictureFileType
- Inherits:
-
Object
- Object
- BigResources::PictureFileType
- Includes:
- Enumerable
- Defined in:
- lib/big_resources/model/file_type.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.is_type(file_name, type) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# 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) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# 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 |
Instance Method Details
#each {|PNG| ... } ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/big_resources/model/file_type.rb', line 12 def each yield PNG yield PDF yield JPG yield JPEG yield BMP end |