Class: Helper

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

Class Method Summary collapse

Class Method Details

.createDirIfNotExist(dirPath) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/Helper.rb', line 16

def self.createDirIfNotExist(dirPath)
    dirs = dirPath.split("/")
    currentDir = ""
    begin
        dir = dirs.shift
        currentDir = "#{currentDir}/#{dir}"
        Dir.mkdir(currentDir) unless File.exists?(currentDir)
    end while dirs.length > 0
end

.unwrapRequiredParameter(obj, key) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/Helper.rb', line 4

def self.unwrapRequiredParameter(obj, key)
    if obj[key].nil?
        raise "Required Parameter Not Found: #{key}"
    else
        if obj[key] == ''
            raise "Required Parameter Is Empty: #{key}"
        else
            return obj[key]
        end
    end
end