Sha256: 875d6cbe465ef99f0d40a7e675f120a181b5f5f700ae45a400e8e5b3adc4f100

Contents?: true

Size: 737 Bytes

Versions: 4

Compression:

Stored size: 737 Bytes

Contents

module Solvable
  def submit_solution!(user, attributes={})
    assignment, _ = find_assignment_and_submit! user, attributes[:content].to_mumuki_solution(language)
    try_solve_discussions(user) if assignment.passed?
    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

4 entries across 4 versions & 1 rubygems

Version Path
mumuki-laboratory-5.6.3 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.6.2 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.6.1 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-5.6.0 app/models/concerns/submittable/solvable.rb