Class: Interfacets::Test::ComponentRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/interfacets/test/component_registry.rb

Constant Summary collapse

DEFAULT_CONFIG_PATH =
"config/interfacets/components.yml"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ComponentRegistry

Returns a new instance of ComponentRegistry.



16
17
18
19
20
# File 'lib/interfacets/test/component_registry.rb', line 16

def initialize(path)
  @path = path
  @schema_cache = {}
  @contracts = load_contracts
end

Instance Attribute Details

#contracts ⇒ Object (readonly)

Returns the value of attribute contracts.



14
15
16
# File 'lib/interfacets/test/component_registry.rb', line 14

def contracts
  @contracts
end

Class Method Details

.load(path = DEFAULT_CONFIG_PATH) ⇒ Object



10
11
12
# File 'lib/interfacets/test/component_registry.rb', line 10

def self.load(path = DEFAULT_CONFIG_PATH)
  new(path)
end

Instance Method Details

#definitions ⇒ Object



26
27
28
# File 'lib/interfacets/test/component_registry.rb', line 26

def definitions
  @contracts["definitions"] || {}
end

#find_component(name) ⇒ Object



22
23
24
# File 'lib/interfacets/test/component_registry.rb', line 22

def find_component(name)
  @contracts[name.to_s]
end