Class: ExtracteurParDate
- Inherits:
-
Object
- Object
- ExtracteurParDate
- Defined in:
- lib/images/extraction/extracteur_par_date.rb
Overview
Extracteur par date
Instance Attribute Summary collapse
-
#regex_patterns ⇒ Object
Returns the value of attribute regex_patterns.
Instance Method Summary collapse
- #extirpabilite(nom) ⇒ Object
- #extraction_du(nom) ⇒ Object
-
#initialize ⇒ ExtracteurParDate
constructor
A new instance of ExtracteurParDate.
Constructor Details
#initialize ⇒ ExtracteurParDate
Returns a new instance of ExtracteurParDate.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/images/extraction/extracteur_par_date.rb', line 12 def initialize @regex_patterns = { /(IMG|VID|PANO)_([0-9]{8})_([0-9]{6})/ => Extraction.new.method(:extract01), /(IMG|VID|PANO)_([0-9]{8})_([0-9]{4})/ => Extraction.new.method(:extract02), /(IMG|VID)_([0-9]{8})_([0-9]{4})-([0-9]{2})/ => Extraction.new.method(:extract02), /(IMG|VID)_([0-9]{14})/ => Extraction.new.method(:extract03), /([0-9]{8})_([0-9]{6})_([0-9]{3})/ => Extraction.new.method(:extract04), /([0-9]{8})_([0-9]{6})_([0-9]{3}) (\([0-9]\))/ => Extraction.new.method(:extract04), /([0-9]{8})_([0-9]{6})/ => Extraction.new.method(:extract04), /^(Resized)_([0-9]{8})_([0-9]{6})_([0-9]{5})$/ => Extraction.new.method(:extract04), /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}\.[0-9]{2}\.[0-9]{2}/ => Extraction.new.method(:extract05), /^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2})\.([0-9]{2})\.([0-9]{2})-([0-9]{1})$/ => Extraction.new.method(:extract05), /([0-9]{2})-([0-9]{2})-([0-9]{4}) ([0-9]{2})-([0-9]{2})-([0-9]{2})/ => Extraction.new.method(:extract08), /(PHOTO|Photo|photo|VIDEO|Video|video)-([0-9]{4})-([0-9]{2})-([0-9]{2})-([0-9]{2})-([0-9]{2})-([0-9]{2})/ => Extraction.new.method(:extract06), /(photo)_([0-9]{4})_([0-9]{2})_([0-9]{2})-([0-9]{2})_([0-9]{2})_([0-9]{2})/ => Extraction.new.method(:extract07), /(photo)_([0-9]{4})_([0-9]{2})_([0-9]{2})-([0-9]{2})_([0-9]{2})_([0-9]{2})-([0-9]{2})/ => Extraction.new.method(:extract07) } end |
Instance Attribute Details
#regex_patterns ⇒ Object
Returns the value of attribute regex_patterns.
10 11 12 |
# File 'lib/images/extraction/extracteur_par_date.rb', line 10 def regex_patterns @regex_patterns end |
Instance Method Details
#extirpabilite(nom) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/images/extraction/extracteur_par_date.rb', line 40 def extirpabilite(nom) est_extirpable = false regex_patterns.each_key do |key| est_extirpable = true if key =~ nom end est_extirpable end |
#extraction_du(nom) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/images/extraction/extracteur_par_date.rb', line 31 def extraction_du(nom) regex_patterns.each_pair do |key, value| next unless key =~ nom return value.call(nom) end raise ExtractionErreur, "Aucune date ne peux ĂȘtre extraite sur '#{nom}'" end |