Class: Hocon::ConfigUtil

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

Overview

Contains static utility methods

Class Method Summary collapse

Class Method Details

.join_path(*elements) ⇒ Object

Converts a list of keys to a path expression, by quoting the path elements as needed and then joining them separated by a period. A path expression is usable with a Config, while individual path elements are usable with a ConfigObject. <p> See the overview documentation for Config for more detail on path expressions vs. keys.

Parameters:

  • elements

    the keys in the path

Returns:

  • a path expression



32
33
34
# File 'lib/hocon/config_util.rb', line 32

def self.join_path(*elements)
  Hocon::Impl::ConfigImplUtil.join_path(*elements)
end

.join_path_from_list(elements) ⇒ Object

Converts a list of strings to a path expression, by quoting the path elements as needed and then joining them separated by a period. A path expression is usable with a Config, while individual path elements are usable with a ConfigObject. <p> See the overview documentation for Config for more detail on path expressions vs. keys.

Parameters:

  • elements

    the keys in the path

Returns:

  • a path expression



51
52
53
# File 'lib/hocon/config_util.rb', line 51

def self.join_path_from_list(elements)
  self.join_path(*elements)
end

.quote_string(string) ⇒ Object

Quotes and escapes a string, as in the JSON specification.

Parameters:

  • string

    a string

Returns:

  • the string quoted and escaped



13
14
15
# File 'lib/hocon/config_util.rb', line 13

def self.quote_string(string)
  Hocon::Impl::ConfigImplUtil.render_json_string(string)
end

.split_path(path) ⇒ Object

Converts a path expression into a list of keys, by splitting on period and unquoting the individual path elements. A path expression is usable with a Config, while individual path elements are usable with a ConfigObject. <p> See the overview documentation for Config for more detail on path expressions vs. keys.

Parameters:

  • path

    a path expression

Returns:

  • the individual keys in the path



70
71
72
# File 'lib/hocon/config_util.rb', line 70

def self.split_path(path)
  Hocon::Impl::ConfigImplUtil.split_path(path)
end