Sha256: db6b43c98e857fbe702ed2793d7fde1c6698bebe6f33c2dcbfd8e98692f8bd6b

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

$lib = File.expand_path('../', File.dirname(__FILE__))

require "logger"

class Helper
    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

    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

    def self.logError(message)
        logger = Logger.new(STDOUT)
        logger.error("#{caller[0]}: #{message}")
    end

    def self.logWarn(message)
        logger = Logger.new(STDOUT)
        logger.warning("#{caller[0]}: #{message}")
    end

    def self.logInfo(message)
        logger = Logger.new(STDOUT)
        logger.info("#{caller[0]}: #{message}")
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ZReviewTender-0.0.7 lib/Helper.rb
ZReviewTender-0.0.6 lib/Helper.rb
ZReviewTender-0.0.5 lib/Helper.rb
ZReviewTender-0.0.4 lib/Helper.rb
ZReviewTender-0.0.3 lib/Helper.rb
ZReviewTender-0.0.2 lib/Helper.rb
ZReviewTender-0.0.1 lib/Helper.rb