lib/exercism/assignment.rb in exercism-0.0.3 vs lib/exercism/assignment.rb in exercism-0.0.4
- old
+ new
@@ -1,15 +1,21 @@
class Exercism
class Assignment
- attr_reader :track, :slug, :readme, :testfile, :tests
+ def self.save(data)
+ data['assignments'].each do |attributes|
+ Assignment.new(attributes).save
+ end
+ end
+ attr_reader :track, :slug, :readme, :test_file, :tests
+
def initialize(attributes)
@track = attributes['track']
@slug = attributes['slug']
@readme = attributes['readme']
- @testfile = attributes['testfile']
+ @test_file = attributes['test_file']
@tests = attributes['tests']
end
def save
FileUtils.mkdir_p assignment_dir
@@ -24,10 +30,10 @@
def readme_path
File.join(assignment_dir, 'README.md')
end
def tests_path
- File.join(assignment_dir, testfile)
+ File.join(assignment_dir, test_file)
end
def assignment_dir
File.join(project_dir, track, slug)
end