Created
February 22, 2016 23:23
-
-
Save evie404/06808f76306095445c66 to your computer and use it in GitHub Desktop.
wtf ruby
This file contains hidden or 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 Lol | |
def initialize(some_array) | |
@some_array = some_array | |
end | |
def lol | |
puts some_array.inspect # returns value | |
some_array += [1] # undefined method `+' for nil:NilClass (NoMethodError) | |
end | |
attr_accessor :some_array | |
end | |
Lol.new([1,2,3]).lol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change to
self.some_array
and things are sane.