Module: FXF
- Defined in:
- lib/fxf.rb
Overview
FXF
Defined Under Namespace
Modules: Standard Classes: Parser
Constant Summary collapse
- VERSION =
version 1.0
'1.0'
Class Method Summary collapse
-
.generate(struct, opts = {}) ⇒ Object
Generates a FXF JSON string.
-
.parse(fxf) ⇒ Object
Parses an FXF string and returns the structure it defines.
Class Method Details
.generate(struct, opts = {}) ⇒ Object
Generates a FXF JSON string.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fxf.rb', line 17 def self.generate(struct, opts={}) # $tm.hrm rv = {} self.generate_object(rv, struct) rv = {'root'=>rv.keys[0], 'objects'=>rv} # return JSON if opts['pretty'] return JSON.pretty_generate(rv) else return JSON.generate(rv) end end |
.parse(fxf) ⇒ Object
Parses an FXF string and returns the structure it defines.
41 42 43 44 |
# File 'lib/fxf.rb', line 41 def self.parse(fxf) parser = FXF::Parser.new(fxf) return parser.parse() end |