Class: Hocon::Parser::ConfigDocumentFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/hocon/parser/config_document_factory.rb

Overview

Factory for creating com.typesafe.config.parser.ConfigDocument instances.

Class Method Summary collapse

Class Method Details

.parse_file(file, options = Hocon::ConfigParseOptions.defaults) ⇒ Object

Parses a file into a ConfigDocument instance.

Parameters:

  • file

    the file to parse

  • options (defaults to: Hocon::ConfigParseOptions.defaults)

    parse options to control how the file is interpreted

Returns:

  • the parsed configuration



22
23
24
# File 'lib/hocon/parser/config_document_factory.rb', line 22

def self.parse_file(file, options = Hocon::ConfigParseOptions.defaults)
  Hocon::Impl::Parseable.new_file(file, options).parse_config_document
end

.parse_string(s, options = Hocon::ConfigParseOptions.defaults) ⇒ Object

Parses a string which should be valid HOCON or JSON.

Parameters:

  • s

    string to parse

  • options (defaults to: Hocon::ConfigParseOptions.defaults)

    parse options

Returns:

  • the parsed configuration



33
34
35
# File 'lib/hocon/parser/config_document_factory.rb', line 33

def self.parse_string(s, options = Hocon::ConfigParseOptions.defaults)
  Hocon::Impl::Parseable.new_string(s, options).parse_config_document
end