Module: Troml

Defined in:
lib/troml.rb,
lib/troml/version.rb

Defined Under Namespace

Classes: Error, ExtParseError

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.parse(raw_toml) ⇒ Hash

Returns a hash representation of the TOML string passed. Raises on parse failure.

Parameters:

  • raw_toml (String)

    The raw TOML as a string.

Returns:

  • (Hash)

    The hash representation of the TOML document, if valid.

Raises:



46
47
48
# File 'lib/troml.rb', line 46

def self.parse(raw_toml)
  TromlExt.parse(raw_toml)
end

.parse_file(file_path) ⇒ Hash

Returns a hash representation of the TOML stored in the file at the provided path. Raises on parse failure or if the file is not present.

Parameters:

  • file_path (String)

    Path to the file to be read.

Returns:

  • (Hash)

    The hash representation of the file’s TOML content.

Raises:



58
59
60
# File 'lib/troml.rb', line 58

def self.parse_file(file_path)
  TromlExt.parse(File.read(file_path))
end