Module: Classification

Defined in:
lib/images/classification/classification.rb

Overview

Classification

Constant Summary collapse

PHOTO =
"photo"
VIDEO =
"video"
OTHER =
"other"
EXTENSIONS_PAR_PREFIXE =
{
  /jpg|jpeg|png|arw/ => PHOTO,
  /mp4|mov/ => VIDEO
}.freeze

Class Method Summary collapse

Class Method Details

.get_type(extension) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/images/classification/classification.rb', line 14

def self.get_type(extension)
  type = OTHER
  EXTENSIONS_PAR_PREFIXE.each_pair do |key, value|
    type = value if key =~ extension[/[a-zA-Z0-9]+/].downcase
  end
  type
end