Class ResultColumn
In: lib/result_column.rb
Parent: Object

Methods

[]   new  

Attributes

alignment  [RW] 
attribute  [RW] 
description  [RW] 
display_method  [RW] 

Public Class methods

[Source]

    # File lib/result_column.rb, line 7
 7:   def self.[](attribute)
 8:     @@columns ||= HashWithIndifferentAccess.new({
 9:       :age => ResultColumn.new(:age, :description => "Age"),
10:       :ages => ResultColumn.new(:ages, :description => "Ages"),
11:       :bar => ResultColumn.new(:bar, :description => "BAR"),
12:       :category_name => ResultColumn.new(:category_name, :description => "Category"),
13:       :category_class => ResultColumn.new(:category_class, :description => "Class"),
14:       :city => ResultColumn.new(:city, :description => "City"),
15:       :date_of_birth => ResultColumn.new(:date_of_birth, :description => "Date of Birth"),
16:       :first_name => ResultColumn.new(:first_name, :description => "First Name"),
17:       :gender => ResultColumn.new(:gender, :description => "Gender"),
18:       :laps => ResultColumn.new(:laps, :description => "Laps", :alignment => :right),
19:       :last_name => ResultColumn.new(:last_name, :description => "Last Name"),
20:       :license => ResultColumn.new(:license, :description => "Lic"),
21:       :name => ResultColumn.new(:name, :description => "Name"),
22:       :notes => ResultColumn.new(:notes, :description => "Notes"),
23:       :number => ResultColumn.new(:number, :description => "Num", :alignment => :right),
24:       :place => ResultColumn.new(:place, :description => "Pl", :alignment => :right),
25:       :points => ResultColumn.new(:points, :description => "Points", :alignment => :right),
26:       :points_bonus => ResultColumn.new(:points_bonus, :description => "Bonus", :alignment => :right),
27:       :points_penalty => ResultColumn.new(:points_penalty, :description => "Penalty", :alignment => :right),
28:       :points_from_place => ResultColumn.new(:points_from_place, :description => "Finish Pts", :alignment => :right),
29:       :points_total => ResultColumn.new(:points_total, :description => "Total Pts", :alignment => :right),
30:       :state => ResultColumn.new(:state, :description => "ST"),
31:       :team_name => ResultColumn.new(:team_name, :description => "Team"),
32:       :time => ResultColumn.new(:time, :description => "Time", :alignment => :right, :display_method => :time_s),
33:       :time_bonus_penalty => ResultColumn.new(:time_bonus_penalty, :description => "Bon/Pen", :alignment => :right, :display_method => :time_bonus_penalty),
34:       :time_gap_to_leader => ResultColumn.new(:time_gap_to_leader, :description => "Down", :alignment => :right, :display_method => :time_gap_to_leader),
35:       :time_gap_to_winner => ResultColumn.new(:time_gap_to_winner, :description => "Down", :alignment => :right, :display_method => :time_gap_to_winner),
36:       :time_total => ResultColumn.new(:time_total, :description => "Overall", :alignment => :right, :display_method => :time_total)
37:     })
38:     unless @@columns[attribute]
39:       @@columns[attribute] = ResultColumn.new(attribute)
40:     end
41:     @@columns[attribute]
42:   end

[Source]

    # File lib/result_column.rb, line 44
44:   def initialize(attribute, options = {})
45:     @alignment = options[:alignment] || :left
46:     @attribute = attribute
47:     @description = options[:description] || attribute.titleize
48:     @display_method = options[:display_method] || attribute
49:   end

[Validate]