Class: Megam::TransferArea

Inherits:
Object
  • Object
show all
Defined in:
lib/megam/transferarea.rb

Overview

class responsible for converting “you”, “root” to the correct directories. This is not a good way to do so.

Class Method Summary collapse

Class Method Details

.convert_to_transferarea_dir(transferarea_name) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/megam/transferarea.rb', line 22

def self.convert_to_transferarea_dir(transferarea_name)
  temp_transferarea_name = transferarea_name.dup
  temp_transferarea_name = temp_transferarea_name.gsub("you", transfer_you_dir) if temp_transferarea_name.match("you")

  temp_transferarea_name = temp_transferarea_name.gsub("root", transfer_root_dir) if temp_transferarea_name.match("root")
  temp_transferarea_name = temp_transferarea_name.gsub(".", File::SEPARATOR)
  temp_transferarea_name
end

.transfer_root_dirObject

the root directory. its stubbed out now to ~/Desktop/tmp/root



32
33
34
# File 'lib/megam/transferarea.rb', line 32

def self.transfer_root_dir
  File.join(File::SEPARATOR)
end

.transfer_you_dirObject

the home directory. its stubbed out now to ~/Desktop/tmp



37
38
39
# File 'lib/megam/transferarea.rb', line 37

def self.transfer_you_dir
  File.join(ENV['HOME']) || Dir.pwd
end