Skip to content

Instantly share code, notes, and snippets.

@ivorpad
Created July 9, 2015 00:41
Show Gist options
  • Save ivorpad/876b52f83c52e4c5ce89 to your computer and use it in GitHub Desktop.
Save ivorpad/876b52f83c52e4c5ce89 to your computer and use it in GitHub Desktop.
Hashes: Setting Attributes - Bloc.io: Full Stack
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