Class: Iglu::Registries::EmbeddedRegistryRef

Inherits:
RegistryRef
  • Object
show all
Defined in:
lib/iglu-client/registries.rb

Overview

This is not a replacement for JVM Embedded Registry It is something more like FileSystemRegistry if you pass absolute path, But by default it’s root is relative to gem

Instance Attribute Summary

Attributes inherited from RegistryRef

#class_priority, #config, #descriptor

Instance Method Summary collapse

Methods inherited from RegistryRef

#vendor_matched

Constructor Details

#initialize(config, path) ⇒ EmbeddedRegistryRef

Returns a new instance of EmbeddedRegistryRef.



73
74
75
76
77
78
79
# File 'lib/iglu-client/registries.rb', line 73

def initialize(config, path)
  @config = config
  @class_priority = 1
  @descriptor = "embedded"

  @root = path
end

Instance Method Details

#lookup_schema(schema_key) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/iglu-client/registries.rb', line 81

def lookup_schema(schema_key)
  schema_path = File.join(@root, 'schemas', schema_key.as_path)
  content = File.read(schema_path)
  JSON::parse(content)
rescue Errno::ENOENT => _
  nil
end