<uberjar>
lol that's still off by one.. just in the other direction
<havenwood>
uberjar: i put extra whitespace in
<uberjar>
oh ok
<uberjar>
oh looks good then, muchos gracias!
<havenwood>
uberjar: de nada
<jhass>
I guess your next step is filtering out those blank itmes then :P
red_menace has quit [Quit: leaving...]
taylorrf has joined #ruby-lang
martinbmadsen has joined #ruby-lang
<uberjar>
for the record I think ruby's is kinda more wrong because to me
<uberjar>
"#gift #vintage #ephemera #glass #porcelain #antique #sale see o ".split(" ").join(" ")
<uberjar>
looks like it should equal the original text to be "the most obvious thing"
<uberjar>
eh, but in some use cases it's kinda nice teh way ruby has it
<uberjar>
x.split(" ").join(" ") == x => false
<jhass>
that's what I meant with correct vs practical ;)
Lewix has joined #ruby-lang
bruno- has joined #ruby-lang
<uberjar>
fyi: "#gift #vintage #jewelry #ephemera #glass #porcelain #antique #sale see o ".trim().split(/\s+/)
<uberjar>
gets a sane split
uberjar has quit [Quit: uberjar]
bruno- has quit [Ping timeout: 265 seconds]
ledestin has quit [Ping timeout: 252 seconds]
j4cknewt_ has joined #ruby-lang
j4cknewt has quit [Read error: Connection reset by peer]
ledestin has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
arooni-mobile has quit [Ping timeout: 265 seconds]
ghostpl_ has joined #ruby-lang
ghostpl_ has quit [Ping timeout: 256 seconds]
taylorrf has quit [Remote host closed the connection]
yfeldblu_ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 265 seconds]
j4cknewt_ has quit [Read error: Connection reset by peer]
j4cknewt has joined #ruby-lang
arooni-mobile has joined #ruby-lang
duderonomy has quit [Ping timeout: 240 seconds]
nedp has joined #ruby-lang
slawrence00 has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
havenwood has quit []
riotjones has joined #ruby-lang
ledestin has quit [Ping timeout: 246 seconds]
ledestin_ has joined #ruby-lang
symm- has joined #ruby-lang
tkuchiki has quit [Ping timeout: 244 seconds]
ledestin_ has quit [Ping timeout: 240 seconds]
ledestin has joined #ruby-lang
riotjones has quit [Ping timeout: 264 seconds]
tkuchiki has joined #ruby-lang
gix has quit [Ping timeout: 272 seconds]
gix has joined #ruby-lang
tunaCanBruh has joined #ruby-lang
tunaCanBruh has quit [Ping timeout: 246 seconds]
SuMo_D has joined #ruby-lang
ur5us has quit [Ping timeout: 256 seconds]
qiffp has quit [Ping timeout: 264 seconds]
SilentNuke has joined #ruby-lang
allomov has joined #ruby-lang
<Musashi007>
would anyone ever be willing to let a noob programmer watch them code?
wprice has joined #ruby-lang
wprice is now known as wprice_sick
<jhass>
Musashi007: Please do not crosspost without at least telling so. Experience shows that people don't bother to inform the other channels of provided solutions, therefore it is considered rude.
<SilentNuke>
There's quite a few sites that list developers who stream while they code Musashi. Just google it, or on Reddit there is a sub dedicated to it.
<yorickpeterse>
why are they even testing if you can dup a method?
havenwood has joined #ruby-lang
<robin850>
piotrj: Hum, that seems to explain it, thanks!
sankaber has joined #ruby-lang
tcopeland has joined #ruby-lang
<robin850>
yorickpeterse: Yep, this seems pretty useless since this test is intended to check whether `duplicable?` works as expected, this is testing Ruby internals :/
<piotrj>
I guess they are testing it in order to be sure that they conform to Ruby implementation
<piotrj>
robin850: so the thing is that they are testing that duplicable has the same behavior as dup in rails. It means that if suddenly Ruby adds dup to Method or removes from something else they would know from tests and can adjust code accordingly
<piotrj>
so that it won't break suddenly for someone in production because he is using newer ruby ;)
<piotrj>
this test seems to be more of safety measure than real test
symm- has quit [Ping timeout: 255 seconds]
<robin850>
piotrj: : Hum, seems more legit then!
lytol has joined #ruby-lang
enebo has joined #ruby-lang
shaman42 has joined #ruby-lang
shinnya has joined #ruby-lang
tunaCanBruh has joined #ruby-lang
lytol has quit [Ping timeout: 255 seconds]
marr has quit [Ping timeout: 265 seconds]
slawrence00 has joined #ruby-lang
chinmay_dd has joined #ruby-lang
tunaCanBruh has quit [Ping timeout: 240 seconds]
fujimura has quit [Remote host closed the connection]
b_hoffman has joined #ruby-lang
taylorrf has joined #ruby-lang
MXfive has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rushed has quit [Quit: rushed]
bruno- has quit [Ping timeout: 240 seconds]
ta has quit [Remote host closed the connection]
qiffp has joined #ruby-lang
Integralist has quit [Quit: leaving]
tunaCanBruh has joined #ruby-lang
mkaesz has quit [Read error: Connection reset by peer]
mkaesz has joined #ruby-lang
MXfive has joined #ruby-lang
My_Hearing is now known as Mon_Ouie
caseydriscoll has quit [Remote host closed the connection]
caseydriscoll has quit [Remote host closed the connection]
Mon_Ouie has quit [Ping timeout: 256 seconds]
<brixen>
piotrj: not really a fan of that argument
<brixen>
piotrj: if that were the case, Rails would be responsible for testing all of the semantics of Ruby (so that it wouldn't break unexpectedly in production)
<brixen>
that's not realistic
taylorrf has quit [Ping timeout: 246 seconds]
<brixen>
further, most people running Rails in production are *not* running Rails tests
<brixen>
they are running their own tests
<brixen>
and their own tests should tell whether their app performs as expected
<piotrj>
brixen: yeah, but here they are doing workaround so that they are not using normal ruby rescue syntax but their own thing. So they want to make sure that it conforms to Ruby implementation
whippythellama has joined #ruby-lang
<piotrj>
and I'm not defending it, I'm just saying why (and it's only my guess) it's there
riotjones has joined #ruby-lang
<brixen>
piotrj: just saying I don't think that "why" cuts it, for the stated reasons
riotjones has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby-lang
<brixen>
I can understand the inclination to try to test something like that given how unspecified Ruby is, but these sorts of tests in Rails are a total PITA for implementers
priodev has quit [Ping timeout: 272 seconds]
drewdavis has quit [Remote host closed the connection]
caseydriscoll has joined #ruby-lang
ReD-BoY_ has joined #ruby-lang
skade has quit [Remote host closed the connection]
tenderlove has joined #ruby-lang
<ReD-BoY_>
hey, hey I am learning Ruby with Well Grounded Rubyist book, and I have a questions about 1 simple exercise, I would like to know if I did it right and how to implement exactly to work Integer class with Array method
<ReD-BoY_>
someone who has a 2 min and willing to help ? Thank you in advance
strixd has quit [Quit: 500]
<jhass>
just make a gist with the requirements and your solution and ask the channel, don't try to find the right person for it ;)
skade has joined #ruby-lang
strixd has joined #ruby-lang
<ReD-BoY_>
it's simple question, i just wanted to find someone who gonna give me quick review of what i have done at this moment, coz i wanna go forward
<jhass>
could be done by now if you just posted it ;)
catmanbun has quit []
mkaesz has quit [Remote host closed the connection]
<ReD-BoY_>
class Integer; def my_times; c = 0; (c..self).my_each do |i|; yield(i); end; self; end; end
zarubin has joined #ruby-lang
<ReD-BoY_>
implementing times Integer method with each method of Array class
<ReD-BoY_>
but i don't know how to make it work with both functions set by myself
<ReD-BoY_>
and does this is the right solution
SuMo_D has quit [Remote host closed the connection]
skade has quit [Remote host closed the connection]
Zionmaster has joined #ruby-lang
SuMo_D has joined #ruby-lang
smoitra has joined #ruby-lang
<ReD-BoY_>
Book : Given the definition of my_each in the main text, how would you use it in an implementation of my_times ? Unlike the first exercise, this one really will be left to you to try on your own!
momomomomo has joined #ruby-lang
lapide_viridi has joined #ruby-lang
zichul has joined #ruby-lang
zarubin has quit [Client Quit]
smoitra has quit [Client Quit]
<piotrj>
brixen: I guess you are right. But at least you know there is a difference in behavior between MRI and Rubinius (or Rails implementers know). Maybe it's something that should be addresed.
smoitra has joined #ruby-lang
<ReD-BoY_>
here we are not talking about Rails at all
martinbmadsen has joined #ruby-lang
Zionmaster has quit [Ping timeout: 250 seconds]
SuMo_D has quit [Ping timeout: 245 seconds]
<ReD-BoY_>
book shows me how to make my own Integer#times and Array#each simple methods
<ReD-BoY_>
then gives me implementation of each over times and tells me to to the same but to build Integer#my_times with Array#my_each
<ReD-BoY_>
Integer#my_times is as follows:
<ReD-BoY_>
class Integer; def my_times; c = 0; until c == self; yield(c); c += 1; end; self; end; end
<brixen>
piotrj: yeah, I get your reasoning
<ReD-BoY_>
it want's me to build it with my_each method instead of looping
drewdavis has joined #ruby-lang
<brixen>
piotrj: it's a hard decision on these edge cases
<brixen>
piotrj: eg, in Rubinius, you can take a method from any method table and put it in any other method table
<brixen>
piotrj: but Ruby doesn't allow that because if implementation details
<ReD-BoY_>
piotrj sry i tough you are speaking to me :/
<brixen>
piotrj: anyway, we're not going to solve this problem, but hopefully we can reduce MRI-specific tests in Rails
ta has joined #ruby-lang
toretore has joined #ruby-lang
martinbmadsen has quit [Ping timeout: 245 seconds]
<ReD-BoY_>
jhass can you help ? :)
<jhass>
ReD-BoY_: mmh, so you wonder how you can return an array if no block is given?
<ReD-BoY_>
i wonder if my solution for building my_times with each method is correct
wolves_cs has joined #ruby-lang
<ReD-BoY_>
and how to usey Array#my_each inside Integer#my_times
ArchRogem has joined #ruby-lang
<jhass>
looks fairly sane to me
<jhass>
if you indeed have to use my_each for it
arooni-mobile has joined #ruby-lang
<jhass>
a gist with all code to make it run might help
centrx has joined #ruby-lang
<ReD-BoY_>
class Integer; def my_times; c = 0; (c..self).each do |i|; yield(i); end; self; end; end - Correct ? (it works perfectly)
MXfive has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<ReD-BoY_>
and if I have my own Array#my_each instead of original Array#each, how to implement it to run inside the Integer class
<jhass>
you would need to turn your Range into in an Array I guess
<jhass>
there's Range#to_a to do that
<ReD-BoY_>
the point is (c..self).each works, but (c..self).my_each doesnt
<ReD-BoY_>
how to tell the class to extend itself with my_each and then use it in Integer class
<jhass>
as said, just turn the Range into an Array with the help of the Range#to_a methodd
<ReD-BoY_>
so Range class has it's own each method ?
<jhass>
yes
<ReD-BoY_>
i seeeeeeeeeeeee
<ReD-BoY_>
thank you very much
<ReD-BoY_>
(bow)
<ReD-BoY_>
so do you think my solution is correct look
<ReD-BoY_>
Book: Given the definition of my_each in the main text, how would you use it in an implementation of my_times ? Unlike the first exercise, this one really will be left to you to try on your own!
<jhass>
I guess so
<ReD-BoY_>
class Integer; def my_times; c = 0; (c..self).to_a.my_each do |i|; yield(i); end; self; end; end
ta has quit [Remote host closed the connection]
<jhass>
hard to tell what the book wants to teach you with that without a lot more context tbh
<jhass>
but from the snippet it seems correct
<jhass>
I'd get rid of the c local btw
<jhass>
(0..self) is just fine
<ReD-BoY_>
shows me simple building simple Array#each and Integer#times methods
<ReD-BoY_>
by myself
<ReD-BoY_>
that's why they are my_times and my_each
unsymbol has quit [Ping timeout: 256 seconds]
<jhass>
well, yeah, but what the books intention is with teaching you how to do it ;)
<ReD-BoY_>
learning Ruby language
<ReD-BoY_>
Well Grounded Rubyist
<ReD-BoY_>
is the book
<jhass>
yeah sure
<ReD-BoY_>
i have never done any programming and was just interested if it's correct, coz it works, but I am kinda very, very newbie in programming exactly
<jhass>
my point is, reimplementing core methods is nothing you gonna do in production code, so I'm wondering which aspect of ruby this exercise is supposed to teach you ;)
skade has joined #ruby-lang
<ReD-BoY_>
i have a lot of experience with windows and softwares in it, but since 1 week I installed Ubuntu, coz i had a lot of issues in Windows and trying to work around with New ubuntu and learn programming with ruby
unsymbol has joined #ruby-lang
<ReD-BoY_>
introduction to collection methods
<ReD-BoY_>
now I am reading about iteration on collections
<jhass>
mmh, so maybe just understanding how they work and play together I guess
<ReD-BoY_>
yes
skade has quit [Remote host closed the connection]
<ReD-BoY_>
not implementing new ones inside the classes
<ReD-BoY_>
but how to say, it works, but I don't know if I am correct and if this is right solution, that's why I wanted more competent opinion....
<piotrj>
brixen: yeah, I guess that issue should be taken to rails contrib group
<ReD-BoY_>
about local variable it showed me for Array#my_each and Integer#my_times to make it like that
<jhass>
weird
<jhass>
are you sure it wasn't meant as parameter instead?
<ReD-BoY_>
instead of 0 == self
<ReD-BoY_>
using c == self
skade has joined #ruby-lang
<ReD-BoY_>
it showed me the normal building of times as follows: class Integer; def my_times; c = 0; until c == self; yield(c); c += 1; end; self; end; end;
<ReD-BoY_>
i cant increment 0 in 0 == self
<ReD-BoY_>
after 0 == self
apeiros_ has quit [Remote host closed the connection]
<jhass>
well, sure
<jhass>
but you no longer increment c on your own
<ReD-BoY_>
but for using each it is possible
apeiros_ has joined #ruby-lang
<ReD-BoY_>
if i use range.to_a.each instead of until c == self then I can use the 0 itself
<jhass>
yes, that's what I'm saying
<ReD-BoY_>
but the range.to_a.each is my own imagination
<ReD-BoY_>
it's not in the book, it tells me to build times with each
<ReD-BoY_>
but shows me times with local variable
priodev has joined #ruby-lang
<jhass>
I guess the book considers such details obvious ;)
<ReD-BoY_>
anyways, what is important, that I do really understand slowly, slowly some things, so I can say I am very happy, to be able to do my_times with each by myself
<ReD-BoY_>
from first try, ofc i made mistake not using to_a
<ReD-BoY_>
to be able to use my own my_each instead of original each
apeiros_ has quit [Ping timeout: 246 seconds]
ta has joined #ruby-lang
<ReD-BoY_>
maybe you are laughing on what I am saying for something maybe incredibly simple, but for me is improvement lol