Changeset 212

Show
Ignore:
Timestamp:
04/22/08 04:09:32 (7 months ago)
Author:
eric.dumin..@gmail.com
Message:

Small tweaks for PlainTextExtractor?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/picolena/templates/app/models/plain_text_extractor.rb

    r195 r212  
    2929    end 
    3030     
    31     # Finds which extractor should be used for a given file, according to its extension 
     31    # Finds which extractor should be used for a given file. 
    3232    # Raises if the file is unsupported.  
    3333    def find_by_filename(filename) 
    3434      ext=File.ext_as_sym(filename) 
    35       found_extractor=all.find{|extractor| extractor.exts.include?(ext)} || raise(ArgumentError, "no convertor for #{filename}") 
    36       found_extractor.source=filename 
    37       found_extractor 
     35      returning find_by_extension(ext) do |found_extractor| 
     36        found_extractor.source=filename 
     37      end 
     38    end 
     39     
     40    # Finds which extractor should be used for a given file, according to its extension 
     41    # Raises if the file is unsupported. 
     42    def find_by_extension(ext) 
     43      all.find{|extractor| extractor.exts.include?(ext)} || raise(ArgumentError, "no convertor for #{filename}") 
    3844    end 
    3945