Sha256: 1263d8805bc375125610c4cb704379ccc302b5d5b5e59d86cbada82b25ea9146

Contents?: true

Size: 964 Bytes

Versions: 8

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

require 'proformaxml/models/base'
require 'proformaxml/models/task_file'
require 'proformaxml/models/test'
require 'proformaxml/models/model_solution'
require 'proformaxml/errors'

module ProformaXML
  class Task < Base
    attr_accessor :title, :description, :internal_description, :proglang, :uuid, :parent_uuid, :language,
      :model_solutions, :files, :tests, :meta_data, :submission_restrictions, :external_resources, :grading_hints

    def initialize(attributes = {})
      super
      self.files = [] if files.nil?
      self.tests = [] if tests.nil?
      self.model_solutions = [] if model_solutions.nil?
      self.meta_data = {} if meta_data.nil?
    end

    def all_files
      task_files = files
      model_solution_files = model_solutions.map(&:files).filter(&:present?)
      test_files = tests.map(&:files).filter(&:present?)
      (task_files + model_solution_files + test_files).flatten.uniq
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
proformaxml-1.5.2 lib/proformaxml/models/task.rb
proformaxml-1.5.1 lib/proformaxml/models/task.rb
proformaxml-1.5.0 lib/proformaxml/models/task.rb
proformaxml-1.4.0 lib/proformaxml/models/task.rb
proformaxml-1.3.0 lib/proformaxml/models/task.rb
proformaxml-1.2.0 lib/proformaxml/models/task.rb
proformaxml-1.1.0 lib/proformaxml/models/task.rb
proformaxml-1.0.0 lib/proformaxml/models/task.rb