Created
September 3, 2012 18:23
-
-
Save safarista/3611733 to your computer and use it in GitHub Desktop.
Trying to replicate God Almighty on the 6th day of the creation theorem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# and afetr he had created everything and saw it was good | |
# ..."On the 6th day he made man and rested on the 7th day" | |
# so lets make some babies | |
class Person | |
def initialize(names, age, gender, status, job = 'Jobless for now') | |
@names = names | |
@age = age | |
@gender = gender | |
@status = status | |
# @job # No need to define this because its already defined | |
@@count = 0 # This is used to store the number of people we create/initiallize | |
end | |
def yawn | |
'Yaaaaaaaaawnnnn!' | |
end | |
def sport | |
'athletics!' | |
end | |
# ... define some more actions here | |
private | |
# Everything private is only accessible within this class i.e. Person | |
def weight(mass) | |
# weight = mass(kilograms) * gravity(10 NKg-1). Simply w = m*a | |
@weight = mass * 10 | |
end | |
end | |
# Our first baby can be concieved in this manner | |
baby1 = Person.new | |
baby1.names = 'John Doe' | |
baby1.age = '1 day' | |
baby1.gender = 'M' | |
baby1.status = 'Under construction' | |
# Our 2nd baby was concieved like this | |
baby2 = Person.new (names: 'Wendy Jane Doe', age: '2', gender: 'F', status: 'Toddler') | |
baby1.names # => John Doe | |
baby2.names # => Windy Jane Doe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment