Module: Script::Loaders::SpecificationHandler

Defined in:
lib/project_types/script/loaders/specification_handler.rb

Class Method Summary collapse

Class Method Details

.load(project:, context:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/project_types/script/loaders/specification_handler.rb', line 6

def self.load(project:, context:)
  identifier = project.specification_identifier
  Models::LazySpecificationHandler.new(identifier) do
    specifications = Models::Specifications.new(
      fetch_specifications: Tasks::FetchSpecifications.new(api_key: project.app.api_key, context: context)
    )

    unless specifications.valid?(identifier)
      context.abort(context.message("errors.unknown_type", project.specification_identifier))
    end

    specifications[identifier]
  end
end