class TDFFaker::GeneralClassification
Constants
- DATA
- NAME
Public Class Methods
country()
click to toggle source
# File lib/tdffaker.rb, line 111 def self.country; DATA.sample[COUNTRY] end
first_name()
click to toggle source
# File lib/tdffaker.rb, line 108 def self.first_name; full_name.split.first end
full_name()
click to toggle source
# File lib/tdffaker.rb, line 107 def self.full_name ; DATA.sample[NAME] end
surname()
click to toggle source
# File lib/tdffaker.rb, line 109 def self.surname ; full_name.split[1..-1].join(" ") end
winner_from(country)
click to toggle source
# File lib/tdffaker.rb, line 116 def self.winner_from country unless all_countries.include? country "Unrecognised country" else DATA.select{ |record| record[COUNTRY] == country}.sample[NAME] end end
year()
click to toggle source
# File lib/tdffaker.rb, line 112 def self.year; DATA.sample[YEAR] end
Private Class Methods
all_countries()
click to toggle source
# File lib/tdffaker.rb, line 126 def self.all_countries DATA.map{ |record| record[COUNTRY] } end