forked from tutsplus/ruby-refactoring
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49e3e1a
commit 8017008
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class Person | ||
attr_reader :first_name, :last_name | ||
|
||
def initialize first_name, last_name | ||
@first_name = first_name | ||
@last_name = last_name | ||
end | ||
|
||
def full_name | ||
first_name + " " + last_name | ||
end | ||
end | ||
|
||
class MalePerson < Person | ||
def gender | ||
"M" | ||
end | ||
end | ||
|
||
class FemalePerson < Person | ||
def gender | ||
"F" | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class Person | ||
attr_reader :first_name, :last_name | ||
|
||
def initialize first_name, last_name | ||
@first_name = first_name | ||
@last_name = last_name | ||
end | ||
|
||
end | ||
|
||
class MalePerson < Person | ||
def full_name | ||
first_name + " " + last_name | ||
end | ||
|
||
def gender | ||
"M" | ||
end | ||
end | ||
|
||
class FemalePerson < Person | ||
def full_name | ||
first_name + " " + last_name | ||
end | ||
|
||
def gender | ||
"F" | ||
end | ||
end |
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