Skip to content

Instantly share code, notes, and snippets.

@evie404
Created February 22, 2016 23:23
Show Gist options
  • Save evie404/06808f76306095445c66 to your computer and use it in GitHub Desktop.
Save evie404/06808f76306095445c66 to your computer and use it in GitHub Desktop.
wtf ruby
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
@krohrbaugh
Copy link

Change to self.some_array and things are sane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment