Class: YamlRefResolver
- Inherits:
-
Object
- Object
- YamlRefResolver
- Defined in:
- lib/yaml_ref_resolver.rb,
lib/yaml_ref_resolver/cli.rb,
lib/yaml_ref_resolver/version.rb
Defined Under Namespace
Classes: CLI
Constant Summary collapse
- VERSION =
"0.4.0"
Instance Method Summary collapse
- #files ⇒ Object
-
#initialize(opts = {}) ⇒ YamlRefResolver
constructor
A new instance of YamlRefResolver.
- #reload(path) ⇒ Object
- #resolve(path) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ YamlRefResolver
5 6 7 8 |
# File 'lib/yaml_ref_resolver.rb', line 5 def initialize(opts = {}) @key = opts[:key] || '$ref' @yaml = {} end |
Instance Method Details
#files ⇒ Object
22 23 24 |
# File 'lib/yaml_ref_resolver.rb', line 22 def files @yaml.keys end |
#reload(path) ⇒ Object
17 18 19 20 |
# File 'lib/yaml_ref_resolver.rb', line 17 def reload(path) @yaml.delete(path) preload_ref_yamls(path) end |
#resolve(path) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/yaml_ref_resolver.rb', line 10 def resolve(path) entry_point = File.(path) preload_ref_yamls(entry_point) resolve_refs(@yaml[entry_point], entry_point) end |