1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-05 18:06:23 +00:00
HackMyResume/src/generators/json-generator.coffee

26 lines
666 B
CoffeeScript
Raw Normal View History

###*
Definition of the JsonGenerator class.
@module generators/json-generator
@license MIT. See LICENSE.md for details.
###
BaseGenerator = require './base-generator'
FS = require 'fs'
_ = require 'underscore'
2016-02-13 21:08:45 +00:00
FJCV = require 'fresh-jrs-converter'
2016-02-13 21:08:45 +00:00
###* The JsonGenerator generates a FRESH or JRS resume as an output. ###
module.exports = class JsonGenerator extends BaseGenerator
constructor: () -> super 'json'
invoke: ( rez ) ->
2016-02-13 21:08:45 +00:00
altRez = FJCV[ 'to' + if rez.format() == 'FRESH' then 'JRS' else 'FRESH' ] rez
altRez = FJCV.toSTRING( altRez )
#altRez.stringify()
generate: ( rez, f ) ->
2016-02-13 21:08:45 +00:00
FS.writeFileSync f, @invoke(rez), 'utf8'
return