module TOML
def self.load_file(path, options = {})
Raises Errno::ENOENT if the file cannot be found.
Raises ValueOverwriteError if a key is overwritten
Returns a Ruby hash representation of the content.
# => {group: {}}
TOML.load_file('/tmp/simple.toml', symbolize_keys: true)
# => {"group"=>{}}
TOML.load_file('/tmp/simple.toml')
Examples
:symbolize_keys - true|false (optional).
options - The Hash options used to refine the parser (default: {}):
path - TOML File path
Public: Returns a hash from a *TOML* file.
def self.load_file(path, options = {}) TOML.parse(File.read(path), options) end
def self.parse(content, options = {})
Returns a Ruby hash representation of the content according to TOML spec.
# => {title: "TOML parser"}
TOML.parse('title = "TOML parser"', symbolize_keys: true)
# => {group: {}}
TOML.parse('[group]', symbolize_keys: true)
# => {"title"=>"TOML parser"}
TOML.parse('title = "TOML parser"')
# => {"group"=>{}}
TOML.parse('[group]')
Examples
:symbolize_keys - true|false (optional).
options - The Hash options used to refine the parser (default: {}):
content - TOML string to be parsed.
Public: Returns a hash from *TOML* content.
def self.parse(content, options = {}) Parser.new(content, options).hash end