1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-05 09:56:22 +00:00
HackMyResume/src/generators/json-generator.coffee
2016-02-13 16:08:45 -05:00

26 lines
666 B
CoffeeScript

###*
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'
FJCV = require 'fresh-jrs-converter'
###* The JsonGenerator generates a FRESH or JRS resume as an output. ###
module.exports = class JsonGenerator extends BaseGenerator
constructor: () -> super 'json'
invoke: ( rez ) ->
altRez = FJCV[ 'to' + if rez.format() == 'FRESH' then 'JRS' else 'FRESH' ] rez
altRez = FJCV.toSTRING( altRez )
#altRez.stringify()
generate: ( rez, f ) ->
FS.writeFileSync f, @invoke(rez), 'utf8'
return