Module: YamlRef

Defined in:
lib/yaml_ref.rb,
lib/yaml_ref/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.load_file(path, ref_home: nil) ⇒ Object

If ref path is defined as a relative path from a specific location, pass ref_home argument or define ref_home on root level in YAML file.

Returns:

  • (Object)


15
16
17
18
19
20
# File 'lib/yaml_ref.rb', line 15

def load_file(path, ref_home: nil)
  result = ERB.new(File.read(path)).result
  schema = YAML.load(result)
  @ref_home = ref_home || schema["ref_home"]
  parse_schema(schema, path)
end