Class: Exam::Examen
- Inherits:
-
Object
- Object
- Exam::Examen
- Includes:
- Inverter
- Defined in:
- lib/exam/examen.rb,
lib/inverter/reverse.rb
Overview
create a Examen
Constant Summary
Constants included from Inverter
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
Instance Method Summary collapse
- #check_exam(a) ⇒ Object
-
#initialize(a) ⇒ Examen
constructor
A new instance of Examen.
- #invertir ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
Methods included from Inverter
Constructor Details
#initialize(a) ⇒ Examen
Returns a new instance of Examen.
7 8 9 |
# File 'lib/exam/examen.rb', line 7 def initialize(a) @list = a end |
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
5 6 7 |
# File 'lib/exam/examen.rb', line 5 def list @list end |
Instance Method Details
#check_exam(a) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/exam/examen.rb', line 11 def check_exam(a) list = @list.clone n = 0 for i in 0..a.size-1 p = list.popHead if (p.check_ans(a[i])) n = n+1 end end puts "#{n}/#{a.size}" return "#{n}/#{a.size}" end |
#invertir ⇒ Object
25 26 27 |
# File 'lib/exam/examen.rb', line 25 def invertir @list=reverse(@list) end |
#size ⇒ Object
29 30 31 |
# File 'lib/exam/examen.rb', line 29 def size @list.size end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/exam/examen.rb', line 33 def to_s @list.to_s end |