tracks/ruby/lib/tasks/exercise.rb in trackler-2.1.0.7 vs tracks/ruby/lib/tasks/exercise.rb in trackler-2.1.0.8
- old
+ new
@@ -21,11 +21,11 @@
def directory
"exercises/#{name}/."
end
def example_file
- 'example.rb'
+ File.exist?(example_filename) ? example_filename : legacy_example_filename
end
def testable_example_file
"#{base_file_name}.rb"
end
@@ -33,9 +33,17 @@
def test_file
"#{base_file_name}_test.rb"
end
private
+
+ def example_filename
+ File.join('.meta', 'solutions', "#{name}.rb")
+ end
+
+ def legacy_example_filename
+ 'example.rb'
+ end
def base_file_name
@_base_file_name ||= name.tr('-', '_')
end
end