Class: HarryPotterFaker
- Inherits:
-
Object
- Object
- HarryPotterFaker
- Defined in:
- lib/harry_potter_faker.rb
Instance Method Summary collapse
- #first_and_last ⇒ Object
- #first_name ⇒ Object
-
#initialize ⇒ HarryPotterFaker
constructor
A new instance of HarryPotterFaker.
- #last_name ⇒ Object
- #name ⇒ Object
- #prefix ⇒ Object
- #suffix ⇒ Object
Constructor Details
#initialize ⇒ HarryPotterFaker
Returns a new instance of HarryPotterFaker.
4 5 6 7 |
# File 'lib/harry_potter_faker.rb', line 4 def initialize require_files create_arrays end |
Instance Method Details
#first_and_last ⇒ Object
25 26 27 |
# File 'lib/harry_potter_faker.rb', line 25 def first_and_last return first_name + " " + last_name end |
#first_name ⇒ Object
17 18 19 |
# File 'lib/harry_potter_faker.rb', line 17 def first_name return $first_names.sample end |
#last_name ⇒ Object
21 22 23 |
# File 'lib/harry_potter_faker.rb', line 21 def last_name return $last_names.sample end |
#name ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/harry_potter_faker.rb', line 9 def name name = "" name += (prefix + " ") if add_extra name += first_and_last name += (" " + suffix) if add_extra return name end |
#prefix ⇒ Object
29 30 31 |
# File 'lib/harry_potter_faker.rb', line 29 def prefix return $prefixes.sample end |
#suffix ⇒ Object
33 34 35 |
# File 'lib/harry_potter_faker.rb', line 33 def suffix return $suffixes.sample end |