Created
June 10, 2013 18:54
-
-
Save iainjmitchell/5751243 to your computer and use it in GitHub Desktop.
Credentials as value object
This file contains hidden or 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 Credentials | |
attr_reader :username, :password | |
def initialize(parameters) | |
@username = parameters[:username] | |
@password = parameters[:password] | |
end | |
end | |
credentials = Credentials.new(username: 'jimmy saville', password: 'nowthennowthen') | |
puts credentials.username | |
puts credentials.password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage should be:
credentials = Credentials.new(:username => 'jimmy saville', :password => 'nowthennowthen')
puts credentials.username
puts credentials.password