Class: Exam::Examen

Inherits:
Object
  • Object
show all
Includes:
Inverter
Defined in:
lib/exam/examen.rb,
lib/inverter/reverse.rb

Overview

create a Examen

Constant Summary

Constants included from Inverter

Inverter::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inverter

#reverse

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

#listObject

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

#invertirObject



25
26
27
# File 'lib/exam/examen.rb', line 25

def invertir
	@list=reverse(@list)
end

#sizeObject



29
30
31
# File 'lib/exam/examen.rb', line 29

def size
	@list.size
end

#to_sObject



33
34
35
# File 'lib/exam/examen.rb', line 33

def to_s
	@list.to_s
end