Module: ElasticGraph::Support::FromYamlFile
- Defined in:
- lib/elastic_graph/support/from_yaml_file.rb
Defined Under Namespace
Classes: ForRakeTasks
Instance Method Summary collapse
-
#from_yaml_file(yaml_file, datastore_client_customization_block: nil) ⇒ Object
Factory method that will build an instance from the provided ‘yaml_file`.
Instance Method Details
#from_yaml_file(yaml_file, datastore_client_customization_block: nil) ⇒ Object
Factory method that will build an instance from the provided ‘yaml_file`. `datastore_client_customization_block:` can be passed to customize the datastore clients. In addition, a block is accepted that can prepare the settings before the object is built (e.g. to override specific settings).
18 19 20 21 22 |
# File 'lib/elastic_graph/support/from_yaml_file.rb', line 18 def from_yaml_file(yaml_file, datastore_client_customization_block: nil) parsed_yaml = ::YAML.safe_load_file(yaml_file, aliases: true) parsed_yaml = yield(parsed_yaml) if block_given? from_parsed_yaml(parsed_yaml, &datastore_client_customization_block) end |