Class: Belajar::Unit
- Inherits:
-
Object
- Object
- Belajar::Unit
- Defined in:
- lib/belajar/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.
5 6 7 8 |
# File 'lib/belajar/unit.rb', line 5 def initialize(path) @path = path @title = File.basename(path).gsub(/\_+/, ' ') end |
Instance Attribute Details
#task ⇒ Object (readonly)
Returns the value of attribute task.
3 4 5 |
# File 'lib/belajar/unit.rb', line 3 def task @task end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/belajar/unit.rb', line 3 def title @title end |
Instance Method Details
#mastered? ⇒ Boolean
22 23 24 |
# File 'lib/belajar/unit.rb', line 22 def mastered? solution.verified? end |
#reference_solution ⇒ Object
14 15 16 |
# File 'lib/belajar/unit.rb', line 14 def reference_solution @reference_solution ||= ReferenceSolution.new(@path) end |