class Poopypants::Name

Constants

FIRSTS
LASTS
MIDDLES

Attributes

first[RW]
last[RW]

Public Class Methods

new(first, last) click to toggle source
# File lib/poopypants.rb, line 11
def initialize(first, last)
  @first = first.gsub(/\W+|\d+|_/, '')
  @last = last.gsub(/\W+|\d+|_/, '')
end

Public Instance Methods

poopify() click to toggle source
# File lib/poopypants.rb, line 16
def poopify
  new_name unless @first.empty? || @last.empty?
end

Private Instance Methods

new_first() click to toggle source
# File lib/poopypants.rb, line 22
def new_first
  FIRSTS["#{@first[0].upcase}"]
end
new_last() click to toggle source
# File lib/poopypants.rb, line 30
def new_last
  LASTS["#{@last[-1].upcase}"]
end
new_middle() click to toggle source
# File lib/poopypants.rb, line 26
def new_middle
  MIDDLES["#{@last[0].upcase}"]
end
new_name() click to toggle source
# File lib/poopypants.rb, line 34
def new_name
  "#{new_first} #{new_middle}#{new_last}"
end