Created
August 5, 2013 14:32
-
-
Save r38y/6156358 to your computer and use it in GitHub Desktop.
Example refactoring of the class in Griddler that parses an email address.
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
module Griddler | |
class Address | |
def initialize(address) | |
@address = address | |
end | |
def some_method_name(type=:hash) | |
if type == :hash | |
parsed_address | |
else | |
parsed_address[type] | |
end | |
end | |
private | |
def parsed_address | |
# ... generate and return the hash version | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment