Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Forked from james/gist:1231642
Created September 21, 2011 09:59
Show Gist options
  • Save lukemorton/1231716 to your computer and use it in GitHub Desktop.
Save lukemorton/1231716 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()
# specifying the parenthesis below resolves your problem
configuration = configuration() + 1
end
end
puts Base.new(2).do_a_thing #=> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment