Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def driver(data)
- [make_last_name(data[2]).upcase!,decade_digit(data[3]),if_fem(month(data[3]),data[-1]),day(data[3]),data[3].chars.last,initials(data[0],data[1]),"9AA"].join("")
- end
- def make_last_name str
- return str if str.size==5
- num= "9"*(5-str.size)
- if str.size<5
- "#{str}"+"#{num}"
- end
- end
- def decade_digit str
- ary= str[-4..-1]
- ary[-2]
- end
- def month str
- ary=str[3..5]
- case ary
- when /Jan|Jan\w*/
- "01"
- when /Feb|Feb\w*/
- "02"
- when /Mar|Mar\w*/
- "03"
- when /Apr|Apr\w*/
- "04"
- when /May|May\w*/
- "05"
- when /Jun|Jun\w*/
- "06"
- when /Jul|Jul\w*/
- "07"
- when /Aug|Aug\w*/
- "08"
- when /Sep|Sep\w*/
- "09"
- when /Oct|Oct\w*/
- "10"
- when /Nov|Nov\w*/
- "11"
- when /Dec|Dec\w*/
- "12"
- end
- end
- def if_fem num,str
- if str=="F" || str== 'f'
- kek= (num[0].to_i+5).to_s<<num[1]
- end
- kek
- end
- def day str
- str[0..1]
- end
- def initials str1,str2
- if !str2.empty?
- str1[0]+str2[0]
- else
- str1[0]+"9"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement