Class: Hocon::ConfigFactory
- Inherits:
-
Object
- Object
- Hocon::ConfigFactory
- Defined in:
- lib/hocon/config_factory.rb
Class Method Summary collapse
- .default_reference ⇒ Object
- .empty(origin_description = nil) ⇒ Object
-
.load_file(file_base_name, parse_options = nil, resolve_options = nil) ⇒ Object
Because of how optional arguments work, if either parse or resolve options is supplied both must be supplied.
- .load_file_with_parse_options(file_base_name, parse_options) ⇒ Object
- .load_file_with_resolve_options(file_base_name, resolve_options) ⇒ Object
- .load_from_config(config, resolve_options) ⇒ Object
- .parse_file(file_path, options = Hocon::ConfigParseOptions.defaults) ⇒ Object
- .parse_file_any_syntax(file_base_name, options) ⇒ Object
- .parse_string(string, options = Hocon::ConfigParseOptions.defaults) ⇒ Object
Class Method Details
.default_reference ⇒ Object
56 57 58 |
# File 'lib/hocon/config_factory.rb', line 56 def self.default_reference Hocon::Impl::ConfigImpl.default_reference end |
.empty(origin_description = nil) ⇒ Object
22 23 24 |
# File 'lib/hocon/config_factory.rb', line 22 def self.empty(origin_description = nil) Hocon::Impl::ConfigImpl.empty_config(origin_description) end |
.load_file(file_base_name, parse_options = nil, resolve_options = nil) ⇒ Object
Because of how optional arguments work, if either parse or resolve options is supplied both must be supplied. load_file_with_parse_options or load_file_with_resolve_options can be used instead, or the argument you don’t care about in load_file can be nil
e.g.: load_file(“settings”, my_parse_options, nil) is equivalent to: load_file_with_parse_options(“settings”, my_parse_options)
34 35 36 37 38 39 40 41 |
# File 'lib/hocon/config_factory.rb', line 34 def self.load_file(file_base_name, = nil, = nil) ||= Hocon::ConfigParseOptions.defaults ||= Hocon::ConfigResolveOptions.defaults config = Hocon::ConfigFactory.parse_file_any_syntax(file_base_name, ) self.load_from_config(config, ) end |
.load_file_with_parse_options(file_base_name, parse_options) ⇒ Object
43 44 45 |
# File 'lib/hocon/config_factory.rb', line 43 def self.(file_base_name, ) self.load_file(file_base_name, , nil) end |
.load_file_with_resolve_options(file_base_name, resolve_options) ⇒ Object
47 48 49 |
# File 'lib/hocon/config_factory.rb', line 47 def self.(file_base_name, ) self.load_file(file_base_name, nil, ) end |
.load_from_config(config, resolve_options) ⇒ Object
51 52 53 54 |
# File 'lib/hocon/config_factory.rb', line 51 def self.load_from_config(config, ) config.with_fallback(self.default_reference).resolve() end |
.parse_file(file_path, options = Hocon::ConfigParseOptions.defaults) ⇒ Object
10 11 12 |
# File 'lib/hocon/config_factory.rb', line 10 def self.parse_file(file_path, = Hocon::ConfigParseOptions.defaults) Hocon::Impl::Parseable.new_file(file_path, ).parse.to_config end |
.parse_file_any_syntax(file_base_name, options) ⇒ Object
18 19 20 |
# File 'lib/hocon/config_factory.rb', line 18 def self.parse_file_any_syntax(file_base_name, ) Hocon::Impl::ConfigImpl.parse_file_any_syntax(file_base_name, ).to_config end |
.parse_string(string, options = Hocon::ConfigParseOptions.defaults) ⇒ Object
14 15 16 |
# File 'lib/hocon/config_factory.rb', line 14 def self.parse_string(string, = Hocon::ConfigParseOptions.defaults) Hocon::Impl::Parseable.new_string(string, ).parse.to_config end |