<panella32>
Thanks guys, I'm still having hard time understanding how differentiate between a local variable like age and (self.)age which the self keyword has been omitted. How the method understand which one I mean? I think this image express my question a bit better https://i.imgur.com/HlZeHs3.png
<leftylink>
what you forgot is that `attr_accessor` defines method `age`.
<leftylink>
therefore, in `Bar`, `age` is the method, `age`.
<panella32>
leftylink great point! Thanks! So does this mean it's impossible for a method to have a local variable named `age`?
<leftylink>
of course it is possible. write `age = 7` and then you've just set a local variable `age` to be 7.
<panella32>
so in this circumstance, age =7 and self.age = 7 means completely two different things, and it means `self.` must not be omitted right?
<leftylink>
that is right
pcw has left #ruby [#ruby]
<panella32>
leftylink so as a final step, back to the code from Hartl book. https://i.imgur.com/jxf59lJ.png In line 23 'remember_token' could be either a `method` or a `local variable`. Without self, how can it not be confused with a local variable?
<leftylink>
because there's no local variable with the name `remember_token`
<leftylink>
therefore it has to be a method
<panella32>
Solved :) Thanks a lot leftylink!! I know my question seems a bit stupid!
Akiyen24 has quit [Ping timeout: 246 seconds]
<leftylink>
for everything that it seems like everyone already knows, they all had to learn it for the first time at some point in the past
<leftylink>
the best thing that a teacher can do is not ridicule students for asking questions that seem obvious. because actually it probably isn't obvious
<leftylink>
if there are teachers that would ridicule "stupid" questions: well, I wouldn't say that it automatically means one should find a better teacher, but they could definitely improve by not doing that
tomtmym has quit [Quit: Gone.]
<panella32>
totally agreed, I wish everybody thought that way. Thanks for that link btw!
thecligu1 has quit [Remote host closed the connection]
brw has quit [Read error: Connection reset by peer]
brw5 has joined #ruby
Demi has joined #ruby
thecligu1 has joined #ruby
teclator has joined #ruby
jhass[m] has joined #ruby
Tomte has joined #ruby
flan[m] has joined #ruby
eddof13 has joined #ruby
tjnhxmzhmqgytuwt has joined #ruby
TomyWork has quit [Remote host closed the connection]
zaben[m] has joined #ruby
shokohsc68 has joined #ruby
shokohsc6 has quit [Ping timeout: 255 seconds]
shokohsc68 is now known as shokohsc6
artemon has joined #ruby
vinay[m] has joined #ruby
moo- is now known as moo
dionysus69 has quit [*.net *.split]
victori has quit [*.net *.split]
polychromata has quit [*.net *.split]
qxz2 has quit [*.net *.split]
dyCrazyEd has quit [*.net *.split]
peder has quit [*.net *.split]
quintasan has quit [*.net *.split]
Malin has quit [*.net *.split]
rhe has quit [*.net *.split]
bhaak has quit [*.net *.split]
dorian has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
<rapha>
hmm is it possible that module/include-based monkey patching doesn't work in JRuby the way we're used to from MRI Ruby?
tiziodcaio has joined #ruby
victori has joined #ruby
polychromata has joined #ruby
Malin has joined #ruby
quintasan has joined #ruby
bhaak has joined #ruby
rhe has joined #ruby
qxz2 has joined #ruby
dyCrazyEd has joined #ruby
peder has joined #ruby
dannyAAM has joined #ruby
dorian has joined #ruby
<adam12>
rapha: I don't see why it wouldn't.
<rapha>
hmm.
<rapha>
adam12: i'm dealing with 2 things at once right now. could you confirm if the example with 'parser = Psych::Parser.new(...' from https://rubyapi.org/3.1/o/s?q=Psych should still work in Ruby 3.1 or 3.2?
<adam12>
rapha: Which example is this? There are a couple without the elipses.
<adam12>
bbiab. lunch
<rapha>
ah, the ellipsis were just to mean "the one that starts like that", adam12
<rapha>
have a good one!
<rapha>
ah, i see the problem
<rapha>
i mean the one that starts with this line:
factor has quit [Read error: Connection reset by peer]
<rapha>
adam12: using the provided alternative, `parser = Psych.parser`. TreeBuilder doesn't exist, not even after explicitly require'ing psych/tree_builder. i'm wondering if the example should be updated.
Tomte has quit [Read error: Connection reset by peer]