Class: Kisaweb::Contest

Inherits:
Base show all
Defined in:
lib/kisaweb/contest.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/kisaweb/contest.rb', line 3

def code
  @code
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/kisaweb/contest.rb', line 3

def date
  @date
end

#organizerObject

Returns the value of attribute organizer.



3
4
5
# File 'lib/kisaweb/contest.rb', line 3

def organizer
  @organizer
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/kisaweb/contest.rb', line 3

def title
  @title
end

Class Method Details

.allObject



11
12
13
# File 'lib/kisaweb/contest.rb', line 11

def self.all
  @@all ||= find_all
end

.find(code) ⇒ Object



5
6
7
8
9
# File 'lib/kisaweb/contest.rb', line 5

def self.find(code)
  all.select do |contest|
    contest.code == code
  end.first
end

.from_csv_array(arr) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kisaweb/contest.rb', line 15

def self.from_csv_array(arr)
  contest = new
  contest.title = arr[1]
  
  contest.date = parse_date(arr[0])
                    
  contest.organizer = arr.last.strip
  contest.code = parse_code(arr[0])
  
  contest
end

Instance Method Details

#attributesObject



27
28
29
30
31
32
33
34
# File 'lib/kisaweb/contest.rb', line 27

def attributes
  {
    :title => title,
    :organizer => organizer,
    :code => code,
    :date => date
  }
end