<|jemc|>
same story - the `click_button` method is called on the result of the preceding expression (whatever that method returns)
lytol has joined #ruby-lang
|jemc| has quit [Ping timeout: 244 seconds]
leat has quit [Ping timeout: 248 seconds]
leat has joined #ruby-lang
charliesome has joined #ruby-lang
leat has quit [Ping timeout: 264 seconds]
leat has joined #ruby-lang
<Technodrome>
wha would be returned in that block? i see a method call, then the setting of an instance variable
Iskarlar has quit [Read error: Connection reset by peer]
Iskarlar has joined #ruby-lang
byprdct has quit [Ping timeout: 250 seconds]
SylarRuby has joined #ruby-lang
charliesome has quit [Quit: zzz]
chinmay_dd has quit [Ping timeout: 248 seconds]
riotjones has joined #ruby-lang
Senjai has quit [Ping timeout: 264 seconds]
fedexo has quit [Ping timeout: 245 seconds]
riotjones has quit [Ping timeout: 265 seconds]
caseypatrickdris has quit [Remote host closed the connection]
Iskarlar has quit [Read error: Connection reset by peer]
Senjai has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
Iskarlar has joined #ruby-lang
fujimura has joined #ruby-lang
fujimura has quit [Ping timeout: 240 seconds]
qba73 has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
skade has joined #ruby-lang
<jhass>
Technodrome: the expression is the method call, foo() and foo() {} and foo do; end; are all method calls, the block is part of the expression. chaining a method onto that expression calls it on the return value, foo.submit, foo {}.submit, foo do; end.submit
qba73 has quit [Ping timeout: 245 seconds]
skade has quit [Read error: Connection reset by peer]
skade has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
kstuart_ has joined #ruby-lang
qba73_ has joined #ruby-lang
qba73_ has left #ruby-lang [#ruby-lang]
kstuart has quit [Ping timeout: 265 seconds]
fujimura has joined #ruby-lang
Iskarlar has quit [Read error: Connection reset by peer]
<Technodrome>
jhass: essentially in tha case its calling .submit on the return value of the get method
Iskarlar has joined #ruby-lang
<jhass>
yes
<Technodrome>
sorry for being stupid on that, just been doing python for a while, i almost forgot that a block is really just an argument, nothing special
<jhass>
no worries
<Technodrome>
jhass: i do have one more question , what does it mean when you have
<Technodrome>
expressions.more.more || new
<jhass>
that's or
<Technodrome>
i know the or
<Technodrome>
but the new , i don’t see how that keyword alone can be valid like that
<jhass>
an expression can be composed of multiple expressions (and usually is in fact)
<jhass>
so expressions.more.more is an expression too
<Technodrome>
the only part that confused me of that , was the new
<jhass>
new is just a method call
<jhass>
or a local variable if one with that name exists
<jhass>
note, that the new in Foo.new is just a method call too
<Technodrome>
yes i’m talking new all by itself right of the OR operator
<Technodrome>
i saw this in a railscasts
<jhass>
expressions.more.more || self.new # would be an equivalent expression
<jhass>
(most likely)
<Technodrome>
there was no self in this case, it was just new
<jhass>
yeah, "equivalent" means "has the same effect/behavior"
<Technodrome>
ah , ok i still don’t see how this is useful
<jhass>
huh?
<jhass>
def create; :a end; a = fetch_from_db || create # does that make sense to you?
skade has quit [Quit: Computer has gone to sleep.]
<Technodrome>
in that expression you made, what is a ?
<Technodrome>
is it inside the method body? , it looks like it is
<jhass>
a symbol
<jhass>
don't worry about it, not the part we're digesting right now
<Technodrome>
so essentially you are doing create :a at the end?
<Technodrome>
i understand symbols from smalltalk
<jhass>
I just put it there so the method returns something, it's not important
<jhass>
do you understand the fetch_from_db || create in that context?
<Technodrome>
ok , so either a = fetch etc returns something with a boolean of true, or it runs create right?
<jhass>
a = (fetch_from_db || create)
<jhass>
so it calls fetch_from_db and if that returns nil or false, it calls create
<jhass>
so a is assigned either the return value of fetch_from_db if it's not nil or false or the return value of create
<Technodrome>
so basically if find by id returns false , it will run new
<jhass>
a = fetch_from_db || new # same thing, either the return value of fetch_from_db if it's not nil or false, or the return value of calling the new method
<Technodrome>
so its calling the new method on the Product class right?
<jhass>
yes, since it's inside a def self.foo
<Technodrome>
so essentially that is calling Product.new? or self.new
<jhass>
both are the same in this case
<Technodrome>
not to sound even more dumb here, but self.something, defines a class method right?
fujimura has quit [Remote host closed the connection]
<jhass>
yeah, we call them that
fujimura has joined #ruby-lang
<jhass>
and new is a class method (a method that you call on the class) too
<Technodrome>
thats why we are able to instansiate a Product object with new there is because its a class method right?
<jhass>
yeah
<Technodrome>
if it was a regular instance method, that woudl not be possible right?
<jhass>
right, there's no instance in that context
<Technodrome>
so you would get an error right away
<Technodrome>
interesting
<Technodrome>
I know all these concepts from other languages and things, its just I’m triying to mold everything
bruno- has quit [Ping timeout: 240 seconds]
<Technodrome>
i had no idea new by itself was the same as self.new but then again new is just a method right, i keep thinkng of it as one of those special
<Technodrome>
“keywords”
<jhass>
yep, a surprising amount of stuff in Ruby is just method calls
<Technodrome>
just as I fogot that the do / end or { } is just an argument
<jhass>
attr_*, include, require, all just methods
<Technodrome>
i was thinking special forms or something
<Technodrome>
heck all property access is just method calls with you have the accessor right
<jhass>
yup
fujimura has quit [Ping timeout: 245 seconds]
<jhass>
all operators too, foo * bar with foo being your own class, you just define a * method on it to make it work
Iskarlar has quit [Read error: Connection reset by peer]
Iskarlar has joined #ruby-lang
lytol has quit [Remote host closed the connection]
gwendall has joined #ruby-lang
<Technodrome>
jhass: humans overcomplicate things
futilegames has quit [Quit: futilegames]
<Technodrome>
jhass: how long you been doing ruby?
<jhass>
mh, a good 3 years I think, though not paid
stef204 has joined #ruby-lang
caseypatrickdris has joined #ruby-lang
toretore has joined #ruby-lang
<Technodrome>
jhass: you don’t do it for work?
<Technodrome>
interesting
<jhass>
student ;)
<Technodrome>
i’ve used ruby before many times, but i usually am just doing rails, whre honestly, you dont even need to know many in and outs of things
<Technodrome>
a few years ago i did learn it pretty well but forgot alot of it because i didn’t use it for so long
rippa has joined #ruby-lang
<Technodrome>
but since my hobbyist language is smalltalk, i will be “ok” i tink
<Technodrome>
think*
RickHull has joined #ruby-lang
Iskarlar has quit [Read error: Connection reset by peer]
Iskarlar has joined #ruby-lang
caseypatrickdris has quit [Ping timeout: 276 seconds]
<Technodrome>
i definitely prefer the beauty of it over Python , but i like python too
yfeldblum has quit [Read error: Connection reset by peer]
yfeldblum has joined #ruby-lang
bruno- has joined #ruby-lang
skade has joined #ruby-lang
bruno- has quit [Ping timeout: 250 seconds]
iamninja has quit [Read error: Connection reset by peer]
iamninja has joined #ruby-lang
djellemah has quit [Ping timeout: 276 seconds]
caseypatrickdris has joined #ruby-lang
caseypatrickdris has quit [Ping timeout: 245 seconds]
sarkyniin has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
j0n3 has quit [Quit: Leaving]
SylarRuby has quit [Remote host closed the connection]
yfeldblu_ has joined #ruby-lang
yfeldbl__ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 245 seconds]
elia has joined #ruby-lang
elia has quit [Client Quit]
yfeldblu_ has quit [Ping timeout: 245 seconds]
iamninja has quit [Read error: Connection reset by peer]
iamninja_ has joined #ruby-lang
arBmind has joined #ruby-lang
LMity has joined #ruby-lang
robbyoconnor has quit [Quit: Konversation terminated!]
leat has quit [Ping timeout: 264 seconds]
LMity has quit [Ping timeout: 252 seconds]
j0n3 has joined #ruby-lang
bruno- has joined #ruby-lang
chinmay_dd has joined #ruby-lang
ur5us has joined #ruby-lang
sankaber has joined #ruby-lang
loincloth has joined #ruby-lang
loincloth has quit [Read error: Connection reset by peer]
k3asd` has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leat has joined #ruby-lang
stef204 has quit [Ping timeout: 256 seconds]
aef_ has quit [Remote host closed the connection]
aef has joined #ruby-lang
elia has joined #ruby-lang
elia has quit [Client Quit]
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
stef204 has joined #ruby-lang
MXfive has joined #ruby-lang
red_menace has joined #ruby-lang
bruno- has quit [Ping timeout: 246 seconds]
skade has joined #ruby-lang
RickHull has left #ruby-lang [#ruby-lang]
chinmay_dd has quit [Ping timeout: 240 seconds]
MXfive has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
loincloth has joined #ruby-lang
loincloth has quit [Read error: Connection reset by peer]
jds has quit [Quit: Connection closed for inactivity]
elia has joined #ruby-lang
gwendall has joined #ruby-lang
allomov has quit [Remote host closed the connection]
elia has quit [Quit: Computer has gone to sleep.]
MXfive has joined #ruby-lang
crdpink has quit [Excess Flood]
crdpink has joined #ruby-lang
jgpawletko has joined #ruby-lang
isale-eko has joined #ruby-lang
skade has quit [Ping timeout: 248 seconds]
skade has joined #ruby-lang
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
enebo has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
workmad3 has joined #ruby-lang
morfeen has joined #ruby-lang
SylarRuby has joined #ruby-lang
yfeldbl__ has quit [Ping timeout: 245 seconds]
postmodern has quit [Quit: Leaving]
elia has joined #ruby-lang
allomov has joined #ruby-lang
workmad3 has quit [Ping timeout: 250 seconds]
Forgetful_Lion has quit [Remote host closed the connection]
victortyau has joined #ruby-lang
chinmay_dd has joined #ruby-lang
allomov has quit [Remote host closed the connection]
loincloth has joined #ruby-lang
loincloth has quit [Ping timeout: 264 seconds]
morfeen has quit [Remote host closed the connection]
chinmay_dd has left #ruby-lang ["Leaving"]
jwaldrip has joined #ruby-lang
jwaldrip has quit [Ping timeout: 264 seconds]
b_hoffman has joined #ruby-lang
cornerma1 has joined #ruby-lang
gwendall has quit [Remote host closed the connection]
caseypatrickdris has joined #ruby-lang
cornerman has quit [Ping timeout: 244 seconds]
cornerma1 is now known as cornerman
gwendall has joined #ruby-lang
k3asd` has quit [Quit: leaving]
k3asd` has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
k3asd` has quit [Quit: leaving]
b_hoffman has quit [Quit: b_hoffman]
allomov has joined #ruby-lang
isale-eko has quit [Ping timeout: 255 seconds]
sgambino has joined #ruby-lang
skade has joined #ruby-lang
alestuber has joined #ruby-lang
<alestuber>
Hello, could someone tell me how to see the source code from the stdlib modules? I'm trying to learn more reading code but I was trying and am still unable to find how to do that :(
<jhass>
alestuber: best is you get pry and pry-doc
havenwood has joined #ruby-lang
<jhass>
then inside pry you just $ Something to get its source and ? Something.else to get its docs
houhoulis has joined #ruby-lang
<jhass>
stdlib is largely in Ruby, so its code is somewhere on your system too, though before we figure out where that might be, you can also just look at it on github: https://github.com/ruby/ruby/tree/trunk/lib
skade has quit [Quit: Computer has gone to sleep.]
<alestuber>
jhass thank you very much :)
SylarRuby has quit [Remote host closed the connection]
<alestuber>
I'll try that. If I fork this repository locally it should be fairly easy to see it too right?
<jhass>
sure, pedantry: the git term is clone
seank_ has quit [Remote host closed the connection]
nedp has quit [Remote host closed the connection]
SylarRuby has joined #ruby-lang
<alestuber>
if someone else has the same doubt I had, just use git clone git://github.com/ruby/ruby.git locally :)