Skip to content

Instantly share code, notes, and snippets.

@r38y
Created August 5, 2013 14:32
Show Gist options
  • Save r38y/6156358 to your computer and use it in GitHub Desktop.
Save r38y/6156358 to your computer and use it in GitHub Desktop.
Example refactoring of the class in Griddler that parses an email address.
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