Skip to content

Instantly share code, notes, and snippets.

@taboularasa
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taboularasa/987d7ee445511ca78eef to your computer and use it in GitHub Desktop.
Save taboularasa/987d7ee445511ca78eef to your computer and use it in GitHub Desktop.
Class Extraction Example
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
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
class Profile
def age
...
end
def favorite_food
...
end
def favorite_color
...
end
end
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