Last active
August 29, 2015 14:26
-
-
Save taboularasa/987d7ee445511ca78eef to your computer and use it in GitHub Desktop.
Class Extraction Example
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
class User | |
def id | |
... | |
end | |
def name | |
... | |
end | |
def age | |
... | |
end | |
def favorite_food | |
... | |
end | |
def favorite_color | |
... | |
end | |
def phone_number | |
... | |
end | |
def street_address_1 | |
... | |
end | |
def street_address_2 | |
... | |
end | |
def city | |
... | |
end | |
def state | |
... | |
end | |
def country | |
... | |
end | |
def postal_code | |
... | |
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
class Address | |
def phone_number | |
... | |
end | |
def street_address_1 | |
... | |
end | |
def street_address_2 | |
... | |
end | |
def city | |
... | |
end | |
def state | |
... | |
end | |
def country | |
... | |
end | |
def postal_code | |
... | |
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
class Profile | |
def age | |
... | |
end | |
def favorite_food | |
... | |
end | |
def favorite_color | |
... | |
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
class ImprovedUser | |
attr_accessor :profile, :address | |
def initialize(profile:, address:) | |
self.profile = profile | |
self.address = address | |
end | |
def id | |
... | |
end | |
def name | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment