Class: Humidifier::Loader
- Inherits:
-
Object
- Object
- Humidifier::Loader
- Defined in:
- lib/humidifier/loader.rb
Overview
Reads the specs/CloudFormationResourceSpecification.json file and load each resource as a class
Defined Under Namespace
Classes: StructureContainer
Constant Summary collapse
- SPECPATH =
The path to the specification file
File.(File.join('..', '..', '..', filename), __FILE__)
Class Method Summary collapse
-
.load ⇒ Object
convenience class method to build a new loader and call load.
Instance Method Summary collapse
-
#load ⇒ Object
loop through the specs and register each class.
Class Method Details
.load ⇒ Object
convenience class method to build a new loader and call load
56 57 58 |
# File 'lib/humidifier/loader.rb', line 56 def self.load new.load end |
Instance Method Details
#load ⇒ Object
loop through the specs and register each class
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/humidifier/loader.rb', line 44 def load parsed = JSON.parse(File.read(SPECPATH)) structs = StructureContainer.new(parsed['PropertyTypes']) parsed['ResourceTypes'].each do |key, spec| match = key.match(/\A(\w+)::(\w+)::(\w+)\z/) register(match[1], match[2], match[3], spec, structs.search(key)) end end |