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('..', '..', '..', 'CloudFormationResourceSpecification.json'), __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
50 51 52 |
# File 'lib/humidifier/loader.rb', line 50 def self.load new.load end |
Instance Method Details
#load ⇒ Object
loop through the specs and register each class
39 40 41 42 43 44 45 46 47 |
# File 'lib/humidifier/loader.rb', line 39 def load parsed = JSON.parse(File.read(SPECPATH)) structs = StructureContainer.new(parsed['PropertyTypes']) parsed['ResourceTypes'].each do |key, spec| match = key.match(/\AAWS::(\w+)::(\w+)\z/) register(match[1], match[2], spec, structs.search(key)) end end |