Public class methods
dump
(struct, io)
[show source]
# File lib/nwn/json_support.rb, line 28 def self.dump struct, io d = if NWN.setting(:pretty_json) ::JSON.pretty_generate(struct) else ::JSON.generate(struct) end io.puts d d.size + 1 end
load
(io)
[show source]
# File lib/nwn/json_support.rb, line 16 def self.load io json = if io.respond_to?(:to_str) io.to_str elsif io.respond_to?(:to_io) io.to_io.read else io.read end NWN::Gff::Struct.unbox!(JSON.parse(json), nil) end