Module: Hocon

Defined in:
lib/hocon.rb

Defined Under Namespace

Modules: ConfigIncludeContext, ConfigIncluderFile, ConfigList, ConfigMergeable, ConfigObject, ConfigParseable, ConfigSyntax, ConfigValue, ConfigValueType, Impl, Parser Classes: ConfigError, ConfigFactory, ConfigParseOptions, ConfigRenderOptions, ConfigResolveOptions, ConfigUtil, ConfigValueFactory

Class Method Summary collapse

Class Method Details

.load(file) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/hocon.rb', line 4

def self.load(file)
  # doing this require lazily, because otherwise, classes that need to
  # `require 'hocon'` to get the module into scope will end up recursing
  # through this require and probably ending up with circular dependencies.
  require 'hocon/config_factory'
  config = Hocon::ConfigFactory.load_file(file)
  return config.root.unwrapped
end

.parse(string) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/hocon.rb', line 13

def self.parse(string)
  # doing this require lazily, because otherwise, classes that need to
  # `require 'hocon'` to get the module into scope will end up recursing
  # through this require and probably ending up with circular dependencies.
  require 'hocon/config_factory'
  config = Hocon::ConfigFactory.parse_string(string)
  return config.root.unwrapped
end