Skip to content

Instantly share code, notes, and snippets.

@iblue
Created August 7, 2014 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iblue/b19246866d973437eaa9 to your computer and use it in GitHub Desktop.
Save iblue/b19246866d973437eaa9 to your computer and use it in GitHub Desktop.
Interview Question :>
# NoMethodError: undefined method `attr_reader' for User:Class
#
# Why?
class User
def initialize(name)
@name = name
end
def hello
puts "Hello, my name is #{name}"
end
 attr_reader :name
end
user = User.new("John")
user.hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment