module VDF

Main VDF module @author sapphyrus

Constants

VERSION

The current version

Public Class Methods

generate(object) click to toggle source

Generates a VDF document from a ruby hash.

@param object [Hash] the input object @return [String] the generated VDF document

# File lib/vdf/generate.rb, line 40
def generate(object)
        Generator.generate(object)
end
parse(input) click to toggle source

Parses a VDF document into a Ruby Hash and returns it

For large files, it's recommended to pass the File object to VDF.parse instead of reading the whole File contents into memory

@param input [String, File, to_str, each_line] the input object @return [Hash] the contents of the VDF document, parsed into a Ruby Hash @raise [ParserError] if the VDF document is invalid @example Parse the contents of a VDF String

contents = VDF.parse(string)

@example Parse the contents of a VDF File

File.open("filename.vdf", "r") do |file|
   contents = VDF.parse(file)
   puts contents.inspect
end
# File lib/vdf/parse.rb, line 128
def parse(input)
        Parser.parse(input)
end

Private Instance Methods

generate(object) click to toggle source

Generates a VDF document from a ruby hash.

@param object [Hash] the input object @return [String] the generated VDF document

# File lib/vdf/generate.rb, line 40
def generate(object)
        Generator.generate(object)
end
parse(input) click to toggle source

Parses a VDF document into a Ruby Hash and returns it

For large files, it's recommended to pass the File object to VDF.parse instead of reading the whole File contents into memory

@param input [String, File, to_str, each_line] the input object @return [Hash] the contents of the VDF document, parsed into a Ruby Hash @raise [ParserError] if the VDF document is invalid @example Parse the contents of a VDF String

contents = VDF.parse(string)

@example Parse the contents of a VDF File

File.open("filename.vdf", "r") do |file|
   contents = VDF.parse(file)
   puts contents.inspect
end
# File lib/vdf/parse.rb, line 128
def parse(input)
        Parser.parse(input)
end