Top Level Namespace

Defined Under Namespace

Modules: Translate2code Classes: Context, JAVAModelDefinition, JSONClass, ModelDefinition, OCModelDefinition

Instance Method Summary collapse

Instance Method Details

#getDirPathObject



10
11
12
13
14
15
# File 'lib/translateUtil.rb', line 10

def getDirPath
   fatherDir = File.expand_path("..", Dir.pwd)
   outputDir = fatherDir + "/Output"
   FileUtils.mkdir_p(outputDir) unless File.exists?(outputDir)
   return outputDir
end

#parseJson(path) ⇒ Object



5
6
7
8
# File 'lib/translateUtil.rb', line 5

def parseJson(path)
    json = File.read(path)
    obj = JSON.parse(json)
end

#replace_file(path, content) ⇒ Object



17
18
19
20
21
# File 'lib/translateUtil.rb', line 17

def replace_file(path, content)
    File.open(path, "w") do |file|
      file.write(content)
    end
end

#startTranlate2Code(jsonFilePath, codeGenerateModel) ⇒ Object



4
5
6
# File 'lib/translate2code.rb', line 4

def startTranlate2Code(jsonFilePath,codeGenerateModel)
   codeGenerateModel.startTranslate(jsonFilePath)
end