Skip to content

Instantly share code, notes, and snippets.

@iainjmitchell
Created June 10, 2013 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iainjmitchell/5751243 to your computer and use it in GitHub Desktop.
Save iainjmitchell/5751243 to your computer and use it in GitHub Desktop.
Credentials as value object
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
@rubygem
Copy link

rubygem commented Jun 11, 2013

usage should be:

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