Class: DiverDown::Web::DefinitionLoader
- Inherits:
-
Object
- Object
- DiverDown::Web::DefinitionLoader
- Defined in:
- lib/diver_down/web/definition_loader.rb
Instance Method Summary collapse
Instance Method Details
#load_file(path) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/diver_down/web/definition_loader.rb', line 7 def load_file(path) hash = case File.extname(path) when '.yaml', '.yml' from_yaml(path) when '.json' from_json(path) else raise ArgumentError, "Unsupported file type: #{path}" end DiverDown::Definition.from_hash(hash) end |