Class: Gotasku::Display

Inherits:
Object
  • Object
show all
Defined in:
lib/gotasku/display.rb

Class Method Summary collapse

Class Method Details

.show(object) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/gotasku/display.rb', line 15

def self.show(object)
	case object
	when ::Gotasku::Problem
		self.show_problem(object)
	when ::Array
		self.show_list(object)
	else
		puts "Sorry, I can't show that.."
	end
end

.show_list(list) ⇒ Object



11
12
13
# File 'lib/gotasku/display.rb', line 11

def self.show_list(list)
	list.each_with_index {|item, i| puts "#{i}...#{item}"}
end

.show_problem(problem) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/gotasku/display.rb', line 2

def self.show_problem(problem)
   puts "=" * 40
  puts "id: #{problem.id}"
  puts "type: #{problem.type}"
	puts "rating: #{problem.rating}"
	puts "difficulty: #{problem.difficulty}"
	puts "=" * 40
end