Class: RandomPerson::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/randomperson/person.rb

Overview

Your general person

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h = {}) ⇒ Person

Returns a new instance of Person.

Parameters:

  • h (optional, Hash) (defaults to: {})

    A hash of the person’s attributes

Options Hash (h):

  • :gender (String)

    nil Gender, ‘m’ for male or ‘f’ for female

  • :age (Integer)

    nil Age

  • :dob (Time)

    nil Date of birth

  • :first (String)

    nil First name

  • :last (String)

    nil Last name

  • :prefix (String)

    nil Prefix e.g. Mr

  • :suffix (String)

    nil Suffix e.g. PhD



16
17
18
19
20
21
22
23
24
# File 'lib/randomperson/person.rb', line 16

def initialize( h={} )
    @gender = h[:gender] || nil
    @age = h[:age] || nil
    @dob = h[:dob] || nil
    @first = h[:first] || nil
    @last = h[:last] || nil
    @prefix = h[:prefix] || nil
    @suffix = h[:suffix] || nil
end

Instance Attribute Details

#ageObject

Returns the value of attribute age.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def age
  @age
end

#dobObject

Returns the value of attribute dob.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def dob
  @dob
end

#firstObject

Returns the value of attribute first.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def first
  @first
end

#genderObject

Returns the value of attribute gender.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def gender
  @gender
end

#lastObject

Returns the value of attribute last.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def last
  @last
end

#prefixObject

Returns the value of attribute prefix.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def prefix
  @prefix
end

#suffixObject

Returns the value of attribute suffix.



6
7
8
# File 'lib/randomperson/person.rb', line 6

def suffix
  @suffix
end