Last active
May 16, 2018 10:14
-
-
Save mleszcz/d6f92841920c9eda5578045b205fb307 to your computer and use it in GitHub Desktop.
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 :settings | |
def active? | |
@settings[:status] == :active | |
end | |
end | |
class AdminUser < User | |
end | |
basic_user = User.new | |
basic_user.settings = { level: 0xFACE, status: :active } | |
basic_user.active? | |
# true | |
admin_user = AdminUser.new | |
admin_user.settings = [ 0xCAFE, :active ] | |
admin_user.active? | |
# TypeError (no implicit conversion of Symbol into Integer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment