Created
July 9, 2015 00:41
-
-
Save ivorpad/876b52f83c52e4c5ce89 to your computer and use it in GitHub Desktop.
Hashes: Setting Attributes - Bloc.io: Full Stack
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
class User | |
attr_accessor :name, :email, :bio, :age, :sex | |
def initialize(config = {}) | |
@name = config[:name] || "n/a" | |
@email = config[:email] || "n/a" | |
@bio = config[:bio] || "n/a" | |
@age = config[:age] || "n/a" | |
@sex = config[:sex] || "n/a" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment