Module: Destinations
- Defined in:
- lib/destinations.rb
Overview
Find move destinations #######################
Instance Method Summary collapse
Instance Method Details
#all_extensions_for(filename) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/destinations.rb', line 6 def all_extensions_for filename destination_map.keys.map{ |extension| safe_extension=Regexp.escape(extension) (filename =~ Regexp.new("#{safe_extension}$")) ? extension : nil }.compact end |
#destination_for(filename) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/destinations.rb', line 13 def destination_for filename longest_extension= all_extensions_for(filename).sort{|a,b| -(a<=>b) }[0] destination_map[longest_extension] end |