class FFIDB::Exporters::JSON
Code generator for the JSON
data interchange language.
Public Instance Methods
begin()
click to toggle source
# File lib/ffidb/exporters/json.rb, line 11 def begin # No header, because JSON doesn't support comments @json = {} end
begin_library(library)
click to toggle source
# File lib/ffidb/exporters/json.rb, line 16 def begin_library(library) @library = library @json[@library&.name] ||= {} end
export_symbol(symbol, **kwargs)
click to toggle source
# File lib/ffidb/exporters/json.rb, line 21 def export_symbol(symbol, **kwargs) @json[@library&.name][symbol.name] = {kind: symbol.kind.to_s}.merge!(symbol.to_h) end
finish()
click to toggle source
# File lib/ffidb/exporters/json.rb, line 34 def finish puts ::JSON.pretty_generate(@json) end
finish_library()
click to toggle source
# File lib/ffidb/exporters/json.rb, line 30 def finish_library @library = nil end