Class: Exercism::Assignment
- Inherits:
-
Object
- Object
- Exercism::Assignment
- Defined in:
- lib/exercism/assignment.rb
Instance Attribute Summary collapse
-
#readme ⇒ Object
readonly
Returns the value of attribute readme.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#testfile ⇒ Object
readonly
Returns the value of attribute testfile.
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
-
#track ⇒ Object
readonly
Returns the value of attribute track.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Assignment
constructor
A new instance of Assignment.
- #save ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Assignment
Returns a new instance of Assignment.
6 7 8 9 10 11 12 |
# File 'lib/exercism/assignment.rb', line 6 def initialize(attributes) @track = attributes['track'] @slug = attributes['slug'] @readme = attributes['readme'] @testfile = attributes['testfile'] @tests = attributes['tests'] end |
Instance Attribute Details
#readme ⇒ Object (readonly)
Returns the value of attribute readme.
4 5 6 |
# File 'lib/exercism/assignment.rb', line 4 def readme @readme end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
4 5 6 |
# File 'lib/exercism/assignment.rb', line 4 def slug @slug end |
#testfile ⇒ Object (readonly)
Returns the value of attribute testfile.
4 5 6 |
# File 'lib/exercism/assignment.rb', line 4 def testfile @testfile end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
4 5 6 |
# File 'lib/exercism/assignment.rb', line 4 def tests @tests end |
#track ⇒ Object (readonly)
Returns the value of attribute track.
4 5 6 |
# File 'lib/exercism/assignment.rb', line 4 def track @track end |
Instance Method Details
#save ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/exercism/assignment.rb', line 14 def save FileUtils.mkdir_p assignment_dir File.open readme_path, 'w' do |f| f.write readme end File.write tests_path, tests end |