Class: Helper

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

Class Method Summary collapse

Class Method Details

.createDirIfNotExist(dirPath) ⇒ Object



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

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

.createWatermark(postURL) ⇒ Object



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

def self.createWatermark(postURL)
    text = "\r\n\r\n\r\n"
    text += "+-----------------------------------------------------------------------------------+"
    text += "\r\n"
    text += "\r\n"
    text += "| **[View original post on Medium](#{postURL}) - Converted by [ZhgChgLi](https://blog.zhgchg.li)/[ZMediumToMarkdown](https://github.com/ZhgChgLi/ZMediumToMarkdown)** |"
    text += "\r\n"
    text += "\r\n"
    text += "+-----------------------------------------------------------------------------------+"
    text += "\r\n"
    
    text
end