Sha256: d7edc48fc2d4d83f4d3565bf68b028d6cb06cfb8f890315c9d3fd92f31689b62

Contents?: true

Size: 683 Bytes

Versions: 20

Compression:

Stored size: 683 Bytes

Contents

module Solvable
  def submit_solution!(user, attributes={})
    assignment, _ = find_assignment_and_submit! user, attributes[:content].to_mumuki_solution(language)
    assignment
  end

  def run_tests!(params)
    language.run_tests!(
      params.merge(
        test: test,
        locale: locale,
        expectations: expectations))
  end
end

class NilClass
  def to_mumuki_solution(language)
    Solution.new
  end
end

class String
  def to_mumuki_solution(language)
    Solution.new content: normalize_whitespaces
  end
end

class Hash
  def to_mumuki_solution(language)
    language
      .directives_sections
      .join(self)
      .to_mumuki_solution(language)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mumuki-laboratory-5.5.0 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.4.0 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.3.0 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.2.1 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.2.0 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.1.1 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.1.0 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.12 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.11 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.10 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.9 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.8 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.7 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.6 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.5 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.4 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.3 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.2 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.1 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.0.0 app/models/concerns/submittable/solvable.rb