Sha256: d86bfe8a7ac6d768fe74c9b495414c90f851ea2b63a6b7f27df996eeda22baa7

Contents?: true

Size: 454 Bytes

Versions: 2

Compression:

Stored size: 454 Bytes

Contents

module Mkfiles

  def self.absolutize_paths(start_directory, rel_paths=[])
    rel_paths = rel_paths.uniq
    start_dir = File.absolute_path start_directory
    if rel_paths.map{|p| p.chomp("/")}.uniq.size != rel_paths.size
      raise ArgumentError.new('file and directory with the same name.')
    end
    abs_paths = []
    rel_paths.each do |path|
      abs_paths << (start_dir + "/" + path)
    end
    return abs_paths
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mkfiles-0.1.2 lib/mkfiles/absolutize_paths.rb
mkfiles-0.1.1 lib/mkfiles/absolutize_paths.rb