Skip to content

Instantly share code, notes, and snippets.

@james
Created September 21, 2011 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save james/1231642 to your computer and use it in GitHub Desktop.
Save james/1231642 to your computer and use it in GitHub Desktop.
attr_accessor parsed as a method variable when setting with a get
class Base
attr_accessor :configuration
def initialize(configuration)
@configuration = configuration
end
def do_a_thing
configuration = configuration + 1
end
end
Base.new(2).do_a_thing #=> NoMethodError: undefined method `+' for nil:NilClass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment