Module: LaunchSupport

Defined in:
lib/launchsupport.rb

Class Method Summary collapse

Class Method Details

.launching_my_file_process(file, param = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/launchsupport.rb', line 17

def self.launching_my_file_process file, param={}
  unless param.empty?
    paths = param[:load]
    paths = [paths] if paths.is_a? String
    param[:project] ||= file.split("/")[file.split("/").rindex{|x|paths.include?(x)}-1]
    parts = "/#{param[:project]}/"
    paths.each do |path|
      $:.unshift file[0,file.index(parts)+parts.size-1]+"/#{path}"
    end
    [param[:require]].flatten.each{|r|require r} if param[:require]
  end
  yield if block_given?
end