Class: Daigaku::Unit
- Inherits:
-
Object
- Object
- Daigaku::Unit
- Defined in:
- lib/daigaku/unit.rb
Instance Attribute Summary collapse
-
#task ⇒ Object
readonly
Returns the value of attribute task.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(path) ⇒ Unit
constructor
A new instance of Unit.
- #mastered? ⇒ Boolean
- #reference_solution ⇒ Object
- #solution ⇒ Object
Constructor Details
#initialize(path) ⇒ Unit
Returns a new instance of Unit.
6 7 8 9 |
# File 'lib/daigaku/unit.rb', line 6 def initialize(path) @path = path @title = File.basename(path).gsub(/\_+/, ' ') end |
Instance Attribute Details
#task ⇒ Object (readonly)
Returns the value of attribute task.
4 5 6 |
# File 'lib/daigaku/unit.rb', line 4 def task @task end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/daigaku/unit.rb', line 4 def title @title end |
Instance Method Details
#mastered? ⇒ Boolean
23 24 25 |
# File 'lib/daigaku/unit.rb', line 23 def mastered? solution.verified? end |
#reference_solution ⇒ Object
15 16 17 |
# File 'lib/daigaku/unit.rb', line 15 def reference_solution @reference_solution ||= ReferenceSolution.new(@path) end |