Class: Fucko::Name

Inherits:
Object
  • Object
show all
Defined in:
lib/fucko/name.rb

Constant Summary collapse

ENDINGS =
["%sson", "von %s", "%sevich", "%sman", "%sowsky", "%s", "%sov", "%sworth", "Mc%s"]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name, last_name) ⇒ Name

Returns a new instance of Name.



22
23
24
25
# File 'lib/fucko/name.rb', line 22

def initialize(first_name, last_name)
  @first_name = first_name
  @last_name = last_name
end

Instance Attribute Details

#first_nameObject (readonly)

Returns the value of attribute first_name.



5
6
7
# File 'lib/fucko/name.rb', line 5

def first_name
  @first_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



5
6
7
# File 'lib/fucko/name.rb', line 5

def last_name
  @last_name
end

Class Method Details

.first_nameObject



9
10
11
# File 'lib/fucko/name.rb', line 9

def self.first_name
  name.first_name
end

.last_nameObject



13
14
15
# File 'lib/fucko/name.rb', line 13

def self.last_name
  name.last_name
end

.nameObject



17
18
19
20
# File 'lib/fucko/name.rb', line 17

def self.name
  self.new(Dictionary.noun.capitalize,
           ENDINGS.sample % Dictionary.noun.capitalize)
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/fucko/name.rb', line 27

def to_s
  "#{first_name} #{last_name}"
end