-
-
Save lukemorton/1231716 to your computer and use it in GitHub Desktop.
attr_accessor parsed as a method variable when setting with a get
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 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