Class: Belajar::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/belajar/unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#taskObject (readonly)

Returns the value of attribute task.



3
4
5
# File 'lib/belajar/unit.rb', line 3

def task
  @task
end

#titleObject (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

Returns:

  • (Boolean)


22
23
24
# File 'lib/belajar/unit.rb', line 22

def mastered?
  solution.verified?
end

#reference_solutionObject



14
15
16
# File 'lib/belajar/unit.rb', line 14

def reference_solution
  @reference_solution ||= ReferenceSolution.new(@path)
end

#solutionObject



18
19
20
# File 'lib/belajar/unit.rb', line 18

def solution
  @solution ||= Solution.new(@path)
end