Guest37794 has quit [Remote host closed the connection]
arescorpio has joined #ruby
mattwashere has quit [Remote host closed the connection]
<karapetyan>
jhass: oh, gcd makes it easy, thanks
<drbrain>
here's an input that'll test your speed: [510510, 1299709]
hahuang61 has quit [Ping timeout: 250 seconds]
<jhass>
well, consider if it's still in the spirit of the kata
<drbrain>
that's the product of the first 7 primes divided by the 100,000th prime
<drbrain>
your implementation takes 10 seconds on my machine
<karapetyan>
ok, i understand, thank you
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
whathappens has quit [Quit: Leaving...]
<drbrain>
I picked those numbers because they'll stress your implementation pretty well, and should give you good clues about how to optimize even if you don't use #gcd
mattwashere has joined #ruby
swills has quit [Remote host closed the connection]
nankyokusei has joined #ruby
<karapetyan>
drbrain: i'l try optimize without using #gcd, thank you.
<drbrain>
if you know how to use #gcd to pass the kata I think that would be OK too
<havenwood>
diegoviola: that's my post-work variant :P
<diegoviola>
haha
<diegoviola>
that's out of my mind
finisherr has quit [Quit: finisherr]
<diegoviola>
nice
agent_white has quit [Quit: brbgoinghom]
<havenwood>
diegoviola: but not quite right
dfockler has quit [Ping timeout: 272 seconds]
<havenwood>
diegoviola: i think that'd get the 7s and 35s right, but not the 5s
<havenwood>
diegoviola: could fix
dhruvasagar has quit [Ping timeout: 260 seconds]
ornerymoose has quit [Quit: ornerymoose]
<havenwood>
just not right at all, but we should do some fun ones for rosetta code
jenrzzz has quit [Ping timeout: 260 seconds]
timanema has joined #ruby
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Silthias has quit [Ping timeout: 244 seconds]
chipotle_ has joined #ruby
jenrzzz has joined #ruby
chipotle has quit [Ping timeout: 250 seconds]
aryaching has quit [Ping timeout: 252 seconds]
harfangk has joined #ruby
jhack has quit [Quit: jhack]
timanema has quit [Ping timeout: 260 seconds]
hxegon is now known as hxegon_afk
ornerymoose has joined #ruby
djbkd has quit [Remote host closed the connection]
RegulationD has joined #ruby
marr has quit [Ping timeout: 244 seconds]
replay has quit []
Silthias has joined #ruby
spiette has quit [Quit: :qa!]
jackjackdripper has quit [Quit: Leaving.]
<diegoviola>
havenwood: I'm trying to write some tests for this with minitest but I'm getting very frustrated by coping the actual output in an assert_equal, is there a better way?
<diegoviola>
copying
<diegoviola>
and trying to compare it
harfangk has quit [Quit: harfangk]
Silthias1 has joined #ruby
Silthias has quit [Read error: Connection reset by peer]
RegulationD has quit [Ping timeout: 260 seconds]
amclain has joined #ruby
<ICantCook>
I've got a ruby script (myscript.rb) which kicks off a linux daemon by running `/opt/my/daemon -d`
<ICantCook>
problem is, myscript.rb keeps running forever
pawnbox has joined #ruby
<ICantCook>
how would i go about kicking off / forking? this command and letting myscript.rb exit
<ICantCook>
if I kill myscript.rb with kill -9, /opt/my/daemon dies too
<isberg>
Does anyone know a tool that reveals exactly where a string/text on a webpage is located? Started building something like this of my own last week but want to check again, just to make sure.
<isberg>
Example input: google.com, "Welcome to Google", output "google.com/file.html" "#logo > a"
matp has quit [Remote host closed the connection]
mattwashere has quit [Remote host closed the connection]
symm- has quit [Ping timeout: 244 seconds]
rcvalle has quit [Quit: rcvalle]
DTZUZU has joined #ruby
AcidCrash0x00 has quit [Read error: Connection reset by peer]
<l4v2>
Sweet, thanks adam12. I was close. everything I saw used the # sign in there
<adam12>
l4v2: #{} is interopolation. So #{good} would of been the value of the local variable 'good'
<adam12>
so it would of worked, had you put `good = "good"` somewhere before it.
<l4v2>
oh ok, thanks
<l4v2>
How is this better than SQL?
jenrzzz has quit [Ping timeout: 264 seconds]
pickandmix has quit [Ping timeout: 250 seconds]
<adam12>
Well for one, if `good` was ";DROP FROM cars" it wouldn't work because it's escaped properly for you.
<l4v2>
THis seems hard lol
<l4v2>
Not seeing it yet
<pontiki>
it isn't better ; it *is* sql
patrick_star has joined #ruby
patrick_star_3 has quit [Ping timeout: 264 seconds]
astrobunny has joined #ruby
<l4v2>
Why not just query the SQL or PostgreSQL way?
<pontiki>
why not?
<pontiki>
when you put a query in a string like that, it *is* SQL
dcunit3d has joined #ruby
SilverKey has joined #ruby
RegulationD has joined #ruby
xall has joined #ruby
mattwashere has joined #ruby
<l4v2>
Are any of you rails developers?
maloik has joined #ruby
<l4v2>
I’m trying to get my first Rails job, and even with a degree, I only got one interview.
RegulationD has quit [Ping timeout: 250 seconds]
<l4v2>
I’ve been learning on my own time
<pontiki>
i've been doing rails dev since ~ 2007
<pontiki>
heavily the last 5 years
<l4v2>
Remotely or on site?
<pontiki>
both
<pontiki>
full-time and contract
<l4v2>
What city are you in?
<pontiki>
why?
<l4v2>
There’s no Rails work in my area.
<l4v2>
I’m probably gonna have to move to NYC
<pontiki>
most major cities in the US there is
<pontiki>
it's never going to be as prevalent as PHP or Java
<l4v2>
Yeah, I’m outside of Syracuse NY, and there’s nothing, but I will move to do it.
mattwashere has quit [Ping timeout: 244 seconds]
edub4rt has quit [Remote host closed the connection]
ponga has joined #ruby
<pontiki>
isn't Rochester a big tech area?
voodoofish430 has quit [Ping timeout: 264 seconds]
<pontiki>
NYC certainly has a lot
voodoofish430 has joined #ruby
conta has joined #ruby
<l4v2>
A lot of places in NY are big tech areas, but only NYC seems to have Rails stuff going on.
<pontiki>
i'm in the twin cities, and there's a bunch here; there's a lot in SF, Denver, KC, PDX, Seattle
<adam12>
Buffalo is really picking up
cdg has quit [Remote host closed the connection]
<l4v2>
I was just in Buffalo and NYC for some other work
<l4v2>
I’d rather go to the big city, where I just paid out my but in tolls, bridge tolls, parking, etc…
<pontiki>
seems to be a lot in TX; i keep getting offers from all over there. This past week I've heard from Ohio, PA, NC too
<l4v2>
How did you get your first Rails job?
smathy_afk is now known as smathy
astrobunny has quit [Remote host closed the connection]
<pontiki>
i was contacted by a recruiter
cyphase has quit [Ping timeout: 260 seconds]
<l4v2>
I can’t even get into the tech field…
<pontiki>
i've been in the tech field since 1980
<smathy>
Better to have some open source contributions/projects to your name than a degree.
astrobunny has joined #ruby
<pontiki>
indeed, yes
<smathy>
...and better to meet and network with people at meetups than apply for advertised jobs.
<pontiki>
much yes
<pontiki>
good jobs, the jobs you want, are not gotten by sending in a resume with a million other people
<pontiki>
they're had by meeting and talking to people, getting to know them and them you
northfurr has quit [Quit: northfurr]
<l4v2>
Sounds like I’m gonna go back to bagging groceries then, because I know no one in this field
djbkd has joined #ruby
<smathy>
Certainly when you're first starting, later, once you have an impressive record and career you can compete with others in an interview/applicant situation.
<pontiki>
you will never meet them if you don't go out and meet them
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
cyphase has joined #ruby
<l4v2>
What a ridiculous field to start out in. I go to school, get a degree, then no one will touch me, because I don’t have a big history, yet in the 80’s and 90’s everyone was learning together.
<smathy>
It was the same in the 80s and 90s.
<pontiki>
what degree?
<l4v2>
Comp Sci
<pontiki>
most ppl in web i've met don't have a degree at all
<l4v2>
I thought I was gonna be all sought after, and I ehar back from no one with a pretty impressive resume
<pontiki>
a lot of the top players i know don't, even
<smathy>
A degree has never meant anything in this industry. Not unless you wanted some boring corporate job.
<smathy>
I have no degree, I dropped out of comsci because it was boring.
<pontiki>
i have a CS degree, but i think i got hired initially because i already had actual dev experience. tonight i said something like "getting my degree didn't prevent from learning to be a developer"
sumobob has quit [Ping timeout: 276 seconds]
kareeoleez has joined #ruby
<l4v2>
Well, I look at this year like it is my fifth year in college, becuase now I am acrually focusing on one thing to be really good at it.
<smathy>
The greatest thing about the tech industry is that it's so easy to prove yourself (with or without a degree).
<smathy>
It's hard for graduates in any industry to get their first job, but at least in tech you can get involved in other things.
<smathy>
...but l4v2, you gotta move from Syracuse - that's just a non-starter.
<smathy>
Heh, pontiki, I love that statement - so true :)
<l4v2>
I keep applying to Rails jobs in NYC and remotely
<smathy>
Yeah, very unlikely to score there with no track record. Remote jobs are the hardest to get because you're competing with everyone else in the whole country.
<l4v2>
I know, that’s why I’m applying to NYC
<pontiki>
are they hiring entry level rails devs anywhere there?
<smathy>
Oh sorry, I thought you meant for remote jobs in NYC.
<smathy>
I'd recommend moving to SF, NY, LA, Chicago, San Diego, or Austin - in that order.
<pontiki>
I'll toss in Minneapolis/St. Paul there; Rails is hot here. The weather sucks mightily tho
<l4v2>
Yeah, I have a place to sublet from in NJ just across the bridge from NYC, but if someone down there would actully respond to my resume I will move.
SilverKey has quit [Quit: Halted.]
<l4v2>
I had one phone interview, and the guy said “Oh learning curve>” and let me go.
<smathy>
l4v2, btw, this is a decent resource to see where all the jobs are: https://whoishiring.io/ - and interesting it suggests I should have mentioned Denver too :)
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cyphase has quit [Ping timeout: 258 seconds]
ketherah has quit [Quit: Connection closed for inactivity]
<l4v2>
Cool, thank you
<smathy>
What that doesn't show though is the insane community that exists in SF. It's like a 24x7 tech convention is constantly in progress there.
<smathy>
If I was just starting my career, there's nowhere else in the world I would be.
<smathy>
(and I don't even like SF :)
yfeldblum has quit [Ping timeout: 250 seconds]
yfeldblum has joined #ruby
<pontiki>
thank you; SF is my love, my true home, my tribal lands
rbennacer has joined #ruby
<smathy>
Heh :) Man, if I could stand living there, I'd be there without question.
cyphase has joined #ruby
<l4v2>
Why don’t you guys like it there?
<pontiki>
i *do* like it there
<smathy>
I was gonna say :)
<pontiki>
i am where i am today because i'm also caring for my parents
<pontiki>
but i'll be back there as soon as i can manage it
<l4v2>
Hey look, and there’s my area - military job, military job, etc…
craigp has joined #ruby
<smathy>
pontiki, ah, fair enough.
<smathy>
I don't like SF because it's humid when it's hot, it's windy when it's cold, lots of homeless, hippies, and socialists. I like visiting the place, but I can't live there.
<pontiki>
i am a hippy, i am a socialist, and i've been homeless :)
<smathy>
Heh :) It is your tribal land ;)
<pontiki>
when it's humid, it's not really humid
zacstewart has quit [Ping timeout: 244 seconds]
<pontiki>
it's actually more humid when it's cold, which is why the wind hurts
<pontiki>
why you wore your expedition parka at candlestick park :D
tmtwd has quit [Ping timeout: 276 seconds]
<pontiki>
i love the whole bay area, all of it, even the "bad" parts
<smathy>
Maybe I've been unlucky, I definitely had some very humid hot days there, but windy and the other things are enough to kill it as an option for me :)
pLaToOn has joined #ruby
<smathy>
I wish I did too, it's such a great place for tech.
<pontiki>
nothing like i get here in the midwest, 90deg and 90%H
<l4v2>
My plain leaves tomorrow.
bnagy has quit [Ping timeout: 246 seconds]
<pontiki>
the bay area has "natural A/C" with the marine layer moving in nightly and cooling everything off
bnagy has joined #ruby
<pontiki>
(which is what makes the humid cold, mostly)
<pontiki>
it's by no means perfect, and by no means suited for everyone
<pontiki>
it is a hugely different mental landscape than most of the rest of the world
<smathy>
l4v2, good for you.
<pontiki>
for me, within that, lies a level of honesty and authenticity i've never felt anywhere else (and i miss it)
<smathy>
Yeah, people are definitely disarmingly up front there.
<l4v2>
I was just kidding, I was gonna go to NYC first, just cause I don’t watn to be too far away from my family.
<pontiki>
another aspect of SF is that it is a mecca for misfits
<smathy>
l4v2, you can definitely make NYC work, that's the second best place in the US for tech. It's definitely a distant second though, and worth thinking about, but close to family is important too for most people.
<l4v2>
That’s where I belong then
<l4v2>
Thanks for the advice. I’m gonna get back to ActiveRecord querying now.
<smathy>
:)
* smathy
heads off too - although to sleep :)
<pontiki>
nini
<smathy>
Smelly hippy!
<l4v2>
Is queryng usually done on Heroku?
<l4v2>
console?
<l4v2>
in production?
<pontiki>
sorry, i dn't use heroku
smathy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<pontiki>
and i never touch production unless there's a huge bug
diablerouge has joined #ruby
<l4v2>
So you do it in development and then push it up
douglascorrea has quit [Remote host closed the connection]
<pontiki>
and then cuss at the devs who made it impossible to debug locally
<pontiki>
yes, dev/text -> qa -> staging -> production
<pontiki>
those arrows go in one direction only
<pontiki>
unless we do a major fuckup
<l4v2>
So go into the Rails Console to mess with the model
<l4v2>
just like I did inside of SQL
astrobunny has quit [Remote host closed the connection]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #ruby
sp4rrow has quit [Client Quit]
harfangk has joined #ruby
<pontiki>
yeah, keep your console stuff within development
<pontiki>
the playing around and experiemnting, i mean
Hyuk has joined #ruby
KINGSABRI__ has joined #ruby
textchimp has left #ruby [#ruby]
joeyjones has left #ruby ["Leaving"]
pLaToOn has quit [Ping timeout: 260 seconds]
<l4v2>
Cool thanks. Last question, what is the most important stuff to now for Rails?
KINGSABRI has quit [Ping timeout: 244 seconds]
astrobunny has joined #ruby
<l4v2>
I read the “Well Grounded Rubyist” as well as making a Twitter themed site with Rails
tmtwd has joined #ruby
elifoster has quit [Ping timeout: 264 seconds]
RegulationD has joined #ruby
iMadper has joined #ruby
rbennacer has quit [Remote host closed the connection]
l4v2 has left #ruby [#ruby]
rkazak has quit [Quit: Sleep.....ing....]
<pontiki>
when not to do something
<pontiki>
just like in jazz -- you have to know what notes not to play
zacstewart has joined #ruby
diablerouge has left #ruby [#ruby]
<pontiki>
the most important thing to know *right now* about rails is it is complex, deep, and often looks like magic
vqrs_ has quit [Ping timeout: 244 seconds]
<pontiki>
so you need to start learning in small bits and pieces; do not ever be afraid to spool up a new rails app on the fly just to figure out one small thing
vqrs has joined #ruby
Coldblackice has joined #ruby
pawnbox has joined #ruby
RegulationD has quit [Ping timeout: 276 seconds]
mtkd has quit [Ping timeout: 276 seconds]
jaguarmagenta has quit [Remote host closed the connection]
mistermocha has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
mistermocha has joined #ruby
yfeldblum has quit [Remote host closed the connection]
mistermocha has quit [Read error: Connection reset by peer]
zacstewart has quit [Ping timeout: 276 seconds]
pLaToOn has joined #ruby
Wolland has quit [Read error: Connection reset by peer]
dcunit3d has quit [Ping timeout: 252 seconds]
Wolland has joined #ruby
pawnbox has quit [Ping timeout: 258 seconds]
lkb has joined #ruby
mistermo_ has joined #ruby
mistermocha has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
TomyLobo has joined #ruby
pLaToOn has quit [Ping timeout: 244 seconds]
mistermocha has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
misterm__ has joined #ruby
mistermo_ has quit [Ping timeout: 250 seconds]
pawnbox has joined #ruby
misterm__ has quit [Ping timeout: 250 seconds]
duncannz has joined #ruby
northfurr has joined #ruby
iMadper is now known as Madper|mtg
Hyuk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sauvin has joined #ruby
ta_ has joined #ruby
chopin has joined #ruby
chopin is now known as Guest67234
dcunit3d has joined #ruby
agit0 has quit [Quit: zzzZZZ….]
northfurr has quit [Quit: northfurr]
moei has quit [Quit: Leaving...]
Es0teric has quit [Quit: Computer has gone to sleep.]
mistermocha has joined #ruby
<timonv>
Does anyone use sidekiq with high req/s on a http server? The server is able to easily 1500req/s, but in sidekiq it just clutters up
mistermocha has quit [Read error: Connection reset by peer]
zacstewart has joined #ruby
<timonv>
simple net http, and benchmarks on the server with ruby show a high req/s as well
Hobogrammer has quit [Ping timeout: 244 seconds]
ornerymoose has joined #ruby
harfangk has quit [Quit: harfangk]
nankyokusei has joined #ruby
northfurr has joined #ruby
Niham has joined #ruby
aufi has joined #ruby
craigp has quit [Ping timeout: 240 seconds]
k3rn31 has quit [Quit: Computer has gone to sleep.]
zacstewart has quit [Ping timeout: 246 seconds]
nankyokusei has quit [Ping timeout: 240 seconds]
mistermocha has joined #ruby
moei has joined #ruby
the_drow has joined #ruby
harfangk has joined #ruby
johns_ has joined #ruby
mistermocha has quit [Ping timeout: 244 seconds]
johns_ has left #ruby [#ruby]
jenrzzz has quit [Ping timeout: 244 seconds]
ornerymoose has quit [Quit: ornerymoose]
andikr has joined #ruby
Guest67234 has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
mistermocha has joined #ruby
last_staff has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
timanema has joined #ruby
tmtwd has quit [Ping timeout: 244 seconds]
agit0 has joined #ruby
timanema has quit [Ping timeout: 240 seconds]
MrBusiness has joined #ruby
workmad3 has joined #ruby
mistermo_ has joined #ruby
hutch34_ has joined #ruby
conta1 has joined #ruby
mistermocha has joined #ruby
firstdayonthejob has joined #ruby
Dimik has joined #ruby
hk238 has joined #ruby
misterm__ has joined #ruby
xall has quit [Ping timeout: 252 seconds]
RegulationD has joined #ruby
sp4rrow has joined #ruby
mistermo_ has quit [Ping timeout: 250 seconds]
hutch34_ has quit [Ping timeout: 244 seconds]
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mistermocha has quit [Ping timeout: 264 seconds]
banister has joined #ruby
misterm__ has quit [Ping timeout: 244 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
firstdayonthejob has quit [Ping timeout: 260 seconds]
ta_ has quit [Remote host closed the connection]
RegulationD has quit [Ping timeout: 258 seconds]
jaguarmagenta has joined #ruby
LoneHermit has quit [Remote host closed the connection]
TomyLobo has quit [Ping timeout: 264 seconds]
harfangk has quit [Quit: harfangk]
AlexRussia has quit [Ping timeout: 246 seconds]
mistermo_ has joined #ruby
ta_ has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
aganov has joined #ruby
northfurr has quit [Quit: northfurr]
douglascorrea has joined #ruby
jenrzzz has joined #ruby
mistermo_ has quit [Ping timeout: 252 seconds]
Madplatypus has quit [Quit: Connection closed for inactivity]
ta_ has quit [Ping timeout: 264 seconds]
pontiki has quit [Quit: "Poets have been mysteriously silent on the subject of cheese." -- G.K.Chesterson]
Madplatypus has joined #ruby
elifoster has joined #ruby
douglascorrea has quit [Ping timeout: 240 seconds]
Wolland has quit []
ur5us has quit [Remote host closed the connection]
haxrbyte has quit [Remote host closed the connection]
yfeldblu_ has joined #ruby
haxrbyte has joined #ruby
xall has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
dcunit3d has quit [Ping timeout: 260 seconds]
vuoto has joined #ruby
jas02 has joined #ruby
BTRE has quit [Remote host closed the connection]
madgen has joined #ruby
rrs has joined #ruby
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
jaruga___ has joined #ruby
rrs has quit [Client Quit]
jaruga___ has quit [Remote host closed the connection]
jaruga___ has joined #ruby
Dimik has quit [Ping timeout: 272 seconds]
dionysus69 has joined #ruby
jaruga___ has quit [Client Quit]
zacstewart has joined #ruby
cyphase has quit [Ping timeout: 264 seconds]
jaruga___ has joined #ruby
Hyuk has joined #ruby
cyphase has joined #ruby
ptierno_ has joined #ruby
BTRE has joined #ruby
zacstewart has quit [Ping timeout: 260 seconds]
djbkd has quit [Quit: My people need me...]
craigp has joined #ruby
ptierno has quit [Ping timeout: 258 seconds]
astrobunny has quit [Remote host closed the connection]
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Hounddog has joined #ruby
anisha has joined #ruby
codecop has joined #ruby
dcunit3d has joined #ruby
astrobunny has joined #ruby
jenrzzz has joined #ruby
n1x-nz has joined #ruby
ruby[bot] has joined #ruby
ta_ has joined #ruby
vondruch has joined #ruby
agit0 has quit [Quit: zzzZZZ….]
TomyWork has joined #ruby
astrobunny has quit [Remote host closed the connection]
astrobunny has joined #ruby
yfeldblu_ has quit [Ping timeout: 250 seconds]
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
madgen has quit [Ping timeout: 264 seconds]
cyphase has quit [Quit: cyphase.com]
jenrzzz has quit [Ping timeout: 260 seconds]
cyphase has joined #ruby
djbkd has joined #ruby
edwinvdgraaf has joined #ruby
jeyraof has quit [Quit: Leaving]
Hyuk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
RegulationD has joined #ruby
ptierno_ has quit [Ping timeout: 244 seconds]
binaryplease1 has joined #ruby
ptierno has joined #ruby
ptierno has quit [Changing host]
ptierno has joined #ruby
binaryplease has quit [Ping timeout: 244 seconds]
haxrbyte has quit [Remote host closed the connection]
haxrbyte has joined #ruby
RegulationD has quit [Ping timeout: 258 seconds]
Pumukel has joined #ruby
LoneHerm_ has joined #ruby
quakephil has joined #ruby
multi_io has quit [Ping timeout: 276 seconds]
multi_io has joined #ruby
mistermocha has joined #ruby
binaryplease1 is now known as binaryplease
LoneHerm_ has quit [Ping timeout: 260 seconds]
Es0teric has joined #ruby
yfeldblum has joined #ruby
dhruvasagar has quit [Ping timeout: 272 seconds]
mistermocha has quit [Ping timeout: 250 seconds]
bigkevmcd has joined #ruby
tmtwd has joined #ruby
eGGshke has joined #ruby
haxrbyte_ has joined #ruby
haxrbyte has quit [Read error: Connection reset by peer]
blaxter has joined #ruby
vuoto has quit [Read error: Connection reset by peer]
vuoto has joined #ruby
rkazak has joined #ruby
haxrbyte_ has quit [Client Quit]
eGGshke has quit [Ping timeout: 246 seconds]
eGGshke has joined #ruby
arajakul has quit [Ping timeout: 252 seconds]
djbkd has quit [Remote host closed the connection]
sepp2k has joined #ruby
haxrbyte has joined #ruby
elifoster has quit [Ping timeout: 244 seconds]
pawnbox_ has joined #ruby
mdw has joined #ruby
dcunit3d has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
pawnbox has quit [Ping timeout: 258 seconds]
Silthias1 has joined #ruby
Spami has joined #ruby
Hyuk has joined #ruby
Hyuk has quit [Max SendQ exceeded]
harfangk has joined #ruby
Silthias has quit [Ping timeout: 258 seconds]
zacstewart has joined #ruby
nofxx has quit [Ping timeout: 260 seconds]
mistermocha has joined #ruby
nofxx has joined #ruby
nofxx has quit [Changing host]
nofxx has joined #ruby
nankyokusei has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
Ropeney has joined #ruby
Ropeney has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 244 seconds]
mistermocha has joined #ruby
zacstewart has quit [Ping timeout: 250 seconds]
dhruvasagar has joined #ruby
nankyokusei has quit [Ping timeout: 258 seconds]
Niham has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
piotrj has joined #ruby
olspookishmagus has quit [Quit: Lost terminal]
mistermocha has quit [Ping timeout: 240 seconds]
tristanp_ has joined #ruby
conta1 has quit [Ping timeout: 244 seconds]
harfangk has quit [Quit: harfangk]
tristanp has quit [Ping timeout: 250 seconds]
harfangk has joined #ruby
nhhc has joined #ruby
olspookishmagus has joined #ruby
dhruvasa1 has joined #ruby
dhruvasagar has quit [Disconnected by services]
dhruvasa1 is now known as dhruvasagar
dhruvasagar is now known as Guest53067
araujo_ has quit [Quit: Leaving]
mdw has quit [Quit: Sleeping Zzzzz]
dh64 has quit [Quit: Konversation terminated!]
tmtwd has quit [Ping timeout: 272 seconds]
harfangk has quit [Quit: harfangk]
mistermocha has joined #ruby
tomphp has joined #ruby
marr has joined #ruby
mrgrieves has joined #ruby
astrobunny has quit [Remote host closed the connection]
mistermo_ has joined #ruby
mistermocha has quit [Ping timeout: 276 seconds]
jackjackdripper has quit [Quit: Leaving.]
piotrj has quit [Quit: leaving]
piotrj has joined #ruby
mistermo_ has quit [Read error: Connection reset by peer]
mistermocha has joined #ruby
RegulationD has joined #ruby
torandu has quit [Ping timeout: 246 seconds]
Couch has joined #ruby
jgt has joined #ruby
mistermo_ has joined #ruby
Silthias1 has quit [Ping timeout: 244 seconds]
mistermo_ has quit [Read error: Connection reset by peer]
Snowy has joined #ruby
jaguarmagenta has quit [Remote host closed the connection]
mistermocha has quit [Read error: Connection reset by peer]
norc has joined #ruby
workmad3 has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
RegulationD has quit [Ping timeout: 252 seconds]
vuoto has quit [Remote host closed the connection]
mistermocha has joined #ruby
LoneHerm_ has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
Spami has quit [Quit: This computer has gone to sleep]
workmad3 has quit [Ping timeout: 276 seconds]
vuoto has joined #ruby
harfangk has joined #ruby
araujo has joined #ruby
pandaant has joined #ruby
MrBusiness2 has joined #ruby
pawnbox_ has quit [Remote host closed the connection]
Silthias has joined #ruby
alexherbo2 has quit [Quit: WeeChat 1.4]
MrBusiness has quit [Ping timeout: 258 seconds]
ta_ has quit [Ping timeout: 260 seconds]
<adaedra>
Hello
LoneHerm_ has quit [Ping timeout: 276 seconds]
pawnbox has joined #ruby
pawnbox has quit [Remote host closed the connection]
yfeldblum has quit [Remote host closed the connection]
Madper|mtg has quit [Remote host closed the connection]
yfeldblum has joined #ruby
xall has quit [Ping timeout: 260 seconds]
tildes has joined #ruby
vuoto has quit [Remote host closed the connection]
mistermocha has joined #ruby
agit0 has joined #ruby
ur5us has joined #ruby
solars has joined #ruby
dsea11 has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
dsea has quit [Ping timeout: 252 seconds]
neo_ has joined #ruby
norc has left #ruby [#ruby]
madgen has joined #ruby
blackgoat has quit [Ping timeout: 246 seconds]
ciampix has joined #ruby
neo_ has quit [Ping timeout: 240 seconds]
agit0 has quit [Quit: zzzZZZ….]
ur5us has quit [Remote host closed the connection]
msvbhat has joined #ruby
<jhass>
timonv: your question is not entirely clear to me, you're making requests and sidekiq has too much overhead? Do you create a job for each request?
<apeiros>
don't use puts. that's useless for debugging.
<romistrub>
haha, ok, use p?
<apeiros>
and why on earth do you write method[:f]
<apeiros>
that's NOT the same as method(:f)
<romistrub>
omg
<romistrub>
typo, I swear
<apeiros>
you can't just randomly replace sigils in proglangs
araujo_ has quit [Quit: Leaving]
<apeiros>
well…
<apeiros>
you've got your current error right there.
<romistrub>
yeaaaaaaah
<romistrub>
I'm embarrassing myself this morning
<apeiros>
your exception also tells you that btw.
hutch34_ has joined #ruby
<apeiros>
line 2 of your exception should read "…:in `method'"
<apeiros>
the :in `method' tells you which method was affected. in your case, the 'method' method.
SilverKey has joined #ruby
d0lph1n98 has joined #ruby
isberg has joined #ruby
RegulationD has joined #ruby
imperator has joined #ruby
<apeiros>
sorry if I'm a bit brusque, might be the heat
shinnya has joined #ruby
ornerymoose has left #ruby [#ruby]
hutch34_ has quit [Ping timeout: 258 seconds]
<jhass>
don't you have some mountain to crawl into down there? :P
RegulationD has quit [Ping timeout: 244 seconds]
<apeiros>
the wifi is crap inside mountains
<Jenzo>
God save the queen!
<Jenzo>
My British pound dropped 20 cents
<apeiros>
?ot Jenzo
<ruby[bot]>
Jenzo: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
<ruby[bot]>
apeiros: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
<apeiros>
!qkick flughafen don't abuse the bot
flughafen was kicked from #ruby by ruby[bot] [don't abuse the bot]
<Jenzo>
sorry wrong room
<Jenzo>
I thought I was in another window
<apeiros>
np Jenzo
jhack has joined #ruby
aries_liuxueyang has joined #ruby
nankyokusei has joined #ruby
<jhass>
apeiros: who needs wifi anyway, you don't have fiber directly into your laptop?
mattwashere has joined #ruby
<apeiros>
sadly no
ledestin has joined #ruby
JeremyM_ has joined #ruby
skade has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
agit0 has joined #ruby
loseyourmind has quit [Ping timeout: 272 seconds]
mtkd has quit [Ping timeout: 250 seconds]
roamingdog has quit [Remote host closed the connection]
strigon33 has joined #ruby
ciampix has joined #ruby
chipotle has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mtkd has joined #ruby
mrgrieves has quit [Ping timeout: 244 seconds]
ledestin has quit [Ping timeout: 252 seconds]
SilverKey has quit [Quit: Halted.]
brendan- has joined #ruby
chipotle has quit [Max SendQ exceeded]
strigonLeader has quit [Ping timeout: 240 seconds]
neo_ has joined #ruby
chipotle has joined #ruby
SilverKey has joined #ruby
<romistrub>
I'm surprised this channel is so quiet, given the number of ruby devs
<apeiros>
and are you really using "if" + ternary + return in a single statement?
<apeiros>
return from == number ? from : to # that's more how ternary is supposed to be used
<jhass>
and no need for return if it's the last expression in your method
mrgrieves has joined #ruby
Snowy is now known as Beendllanke
<karapetyan>
oh, thank you.
jenrzzz has quit [Ping timeout: 260 seconds]
hutch34_ has joined #ruby
SilverKey has quit [Quit: Halted.]
zacstewart has joined #ruby
jhack has quit [Quit: jhack]
AlexJakeGreen has joined #ruby
Amnez777- has quit [Ping timeout: 246 seconds]
Alina-malina has quit [Ping timeout: 240 seconds]
Oberon has joined #ruby
msvbhat has quit [Ping timeout: 246 seconds]
zacstewart has quit [Ping timeout: 258 seconds]
DTZUBDUB has joined #ruby
isxek has quit [Quit: Leaving]
<Oberon>
Is anyone on that'd be willing to help me refactor a simple script? I'm trying to teach myself Ruby outside of the free courses online and just what I can figure out on the docs
MrBusiness2 has joined #ruby
djbkd has joined #ruby
Niham has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tvw has joined #ruby
spidapeeg has joined #ruby
<spidapeeg>
Are people live?
<spidapeeg>
#!/usr/bin/ruby # 35 students in our class NUM_STUDENTS = 35 # Max grade of 100% MAX_GRADE = 100 num_compare = 0 arr = Array.new(NUM_STUDENTS) # Randomly populate arr for i in 0..(NUM_STUDENTS - 1) # Maximum possible grade is 100%, keep in mind that rand(5) returns possible values 0-4, so we must add 1 to MAX_GRADE arr[i] = rand(MAX_GRADE + 1) end # Output cur
<aegis3121>
let's go with a gist for that, please?
<spidapeeg>
It is a sort for an array
<pontiki>
seems like the stupid is out in force this morning
<adam12>
Oberon: If you share your code in a gist with a question, people might chime in.
<Oberon>
Simple script that count words, chars, and lines. Reteaching myself ruby. It works, but I know its ugly af. 8 iterations currently.. trying to refactor it down.
MrBusiness2 has quit [Ping timeout: 258 seconds]
davedev24 has joined #ruby
anisha has quit [Quit: Leaving]
LoneHerm_ has quit [Remote host closed the connection]
<pontiki>
Oberon: write tests before you refactor anything
snath has quit [Ping timeout: 252 seconds]
chipotle has quit [Quit: cheerio]
caudill has quit [Remote host closed the connection]
SilverKey has joined #ruby
ullu has quit [Ping timeout: 260 seconds]
<adam12>
Oberon: I'd start with opening and reading the file only once.
<adam12>
Oberon: I don't believe lines 15-17 do what you think they do (which I believe is nothing)
<spidapeeg>
Why do we do NUM_STUDENTS - 2 in line 23?
<Oberon>
15 checks for extra chars that could confuse the script for words, need to add the check for hyphens
<Oberon>
17 is how the array of words is formed so it can be counted
lkb_ has joined #ruby
<Oberon>
er, how the array is given a value with words
<adam12>
Oberon: The block of 13 through 19 could likely be an assignment with file.each.line.reduce. `words_count = file.each_line.reduce(0) {|line, acc| acc + line.length}` or something similar.
<adam12>
Oberon: What I am saying is I am not sure you can manipulate values like you are doing. Did you test that it works?
<Oberon>
Gotcha
<adam12>
ie. you can't reassign in the block and expect it to work.
<Oberon>
I mean it outputs the correct number in the terminal when I run it
ekinmur_ has joined #ruby
benlieb has quit [Quit: benlieb]
nando293921 has joined #ruby
polishdub has joined #ruby
lkb has quit [Ping timeout: 276 seconds]
benlieb has joined #ruby
Hounddog has quit [Remote host closed the connection]
Guest8082 has quit [Read error: Connection reset by peer]
mrgrieves has quit [Ping timeout: 240 seconds]
neo_ has joined #ruby
Jardayn has quit [Read error: Connection reset by peer]
<shevy>
huh rubygems-2.6.6/bundler/
lucas__ is now known as lucas
SilverKey has joined #ruby
aufi has quit [Remote host closed the connection]
infra-red has quit []
pandaant has quit [Remote host closed the connection]
agit0 has joined #ruby
Asher has quit [Read error: Connection reset by peer]
neo_ has quit [Ping timeout: 260 seconds]
mrgrieves has joined #ruby
msvbhat has quit [Ping timeout: 240 seconds]
moeabdol has joined #ruby
pawnbox has quit [Remote host closed the connection]
terrabl has joined #ruby
mdw has joined #ruby
JeremyM_ has joined #ruby
ta_ has joined #ruby
<terrabl>
Hello, I need to be able to take a JSON response from HTTParty, and then turn that into a hash so that I can run key value pairs on it. But everything I am attempting to do isn't working. It was working when I hard coded the hash but when I did JSON.parse(response.body), which I though puts the JSON to a hash it isnt allowing me to access elements using hash[:key]
<jhass>
terrabl: show your code and the full error message that you get via gist.github.com
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
moeabdol has quit [Ping timeout: 264 seconds]
jas02 has quit [Quit: jas02]
neo_ has joined #ruby
senayar_ has quit [Ping timeout: 276 seconds]
redbaritone has joined #ruby
<jtperreault>
terrabl: I believe JSON.parse() uses string keys (not symbols) by default. So, based on your example, you should be able to access the data using hash["key"] rather than hash[:key]
MrBusiness3 has joined #ruby
jetpack_joe has joined #ruby
<terrabl>
Yeah I know that but if I do that then I cant cycle through using .each do |key, value|
agit0 has quit [Read error: Connection reset by peer]
<jhass>
terrabl: sure you can
dopie_ has quit [Quit: Lost terminal]
djbkd has quit [Remote host closed the connection]
MrBusiness2 has quit [Ping timeout: 272 seconds]
<terrabl>
really? because when I do hash["details"].each do |k, v| it gives me an error
<terrabl>
ah frick i was missing the hash[0]["details"
<jhass>
terrabl: as already mentioned, if you want help "an error" is completely and utterly useless
<terrabl>
Yeah I know I think I figured it out, I was making the gist
<jhass>
pickandmix: you have no postgresql running
Beendllanke has quit [Remote host closed the connection]
Beendllanke has joined #ruby
<pickandmix>
jhass: But I have installed postgresql?
<jhass>
doesn't mean it's running
<pickandmix>
um jhass so how do I run it? :/
ruby-lang407 has quit [Ping timeout: 250 seconds]
<jhass>
that's a question for your operating system's support channel
rodfersou is now known as rodfersou|lunch
<pickandmix>
right, thanks alot!
platzhirsch has quit [Quit: WeeChat 1.4]
aganov has quit [Remote host closed the connection]
NSABear has joined #ruby
<NSABear>
Question
<jhass>
Answer
<NSABear>
Ruby -> exe / .app
<NSABear>
Possible?
<jhass>
Traveling Ruby, somewhat
<NSABear>
ok
<NSABear>
Ruby -> recording / playing audio
<NSABear>
Possible?
snath has quit [Ping timeout: 250 seconds]
<jhass>
sure
<NSABear>
Ruby -> voip client
<NSABear>
Possible?
RegulationD has quit [Ping timeout: 240 seconds]
<jhass>
should be
<NSABear>
any good gems I should Know of?
<NSABear>
I'm considering learning Ruby.
<jhass>
no idea
ChiefAlexander has quit [Quit: Leaving...]
nando293921 has quit [Quit: Lost terminal]
Beendllanke has quit [Ping timeout: 250 seconds]
troulouliou_div2 has joined #ruby
deuterium has quit [Ping timeout: 276 seconds]
nando293921 has joined #ruby
<shevy>
prawn is a good gem!
[Butch] has joined #ruby
hutch34_ has quit [Ping timeout: 260 seconds]
<NSABear>
I really do want to learn ruby
<NSABear>
It's interesting.
apawl has joined #ruby
<shevy>
start today!
<NSABear>
Ruby -> Gui gems
hutch34_ has joined #ruby
<NSABear>
Any good ones?
<adaedra>
Lots, but it all depends what you want.
<jhass>
gir_ffi-gtk looks decent
<NSABear>
ok
<mello>
shoes, VR with glade is great
<apawl>
Silly question. Does Tempfile have to store files in /tmp? It's filling up my tmpfs, and I'd like to still have the ephemeral/automatic cleanup functionality of Tempfile, but temporarily stored somewhere on disk.
<wrkrcoop>
but when i run it in irb it says NoMethodError: undefined method `present?' for []:Array
<toretore>
there is no method "present?" in ruby's stdlib
<wrkrcoop>
wth
mistermo_ has quit [Read error: Connection reset by peer]
misterm__ has joined #ruby
<wrkrcoop>
what do i need to include
mistermocha has quit [Ping timeout: 250 seconds]
<toretore>
what is the problem you're trying to solve?
CJKinni` has joined #ruby
SilverKey has quit [Client Quit]
moeabdol has quit [Ping timeout: 244 seconds]
timanema has quit [Ping timeout: 260 seconds]
SilverKey has joined #ruby
miqlas-H has joined #ruby
rippa has joined #ruby
arajakul1 has joined #ruby
<wrkrcoop>
toretore: im trying to read some code and understand what it is doing, but since i used [].present? and that said no method i couldn’t figure out what the code was doing
mistermocha has joined #ruby
<wrkrcoop>
just looking for clarification
misterm__ has quit [Read error: Connection reset by peer]
geekbri has joined #ruby
64MAAIAT7 has quit [Remote host closed the connection]
<shevy>
hmm https://github.com/hsbt - what is the first name and what is the last name? the CAPS is the family name? I'd like to know so that I don't use the wrong name in an email/issue request on github
SilverKey has quit [Client Quit]
arajakul has quit [Ping timeout: 276 seconds]
<toretore>
usually caps is family name
<wrkrcoop>
they must be including some library
<toretore>
did you look at the link i pasted?
<jhass>
shevy: you could also just omit it, Hello, Hi, Hey, Greetings, ...
harfangk has quit [Quit: harfangk]
<shevy>
jhass hmm yeah
<wrkrcoop>
u sent me a link to a google search
<shevy>
"Hey japanese dude!"
<toretore>
wrkrcoop: what were the results of this search?
mistermo_ has joined #ruby
lucas has quit [Ping timeout: 260 seconds]
Xeago_ has quit [Remote host closed the connection]
neo__ has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
lucas has joined #ruby
MrBusiness3 has joined #ruby
gigetoo has quit [Ping timeout: 260 seconds]
timanema has joined #ruby
Ebok has joined #ruby
nictrasavios has joined #ruby
moeabdol has joined #ruby
gigetoo has joined #ruby
pawnbox has joined #ruby
PaulCape_ has quit [Quit: .]
mistermo_ has quit [Read error: Connection reset by peer]
mattwashere has quit [Remote host closed the connection]
<nictrasavios>
Hello! I'm sort of new-ish to ruby, and I'm looking for someone to help me turn a cludge into elegance.
<shevy>
oh a poetry question, out with it
<wrkrcoop>
?asl
<ruby[bot]>
wrkrcoop: I don't know anything about asl
<ruby[bot]>
Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
<wrkrcoop>
!
<wrkrcoop>
man i feel bad ass for using ?ask
<nictrasavios>
Don't worry, I should have known to just ask ;).
djbkd has quit [Remote host closed the connection]
<nictrasavios>
I'm just timid in new communities.
mistermocha has joined #ruby
PaulCapestany has joined #ruby
neo_ has quit [Ping timeout: 240 seconds]
djbkd has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
doubledouble has joined #ruby
A124 has quit [Ping timeout: 244 seconds]
mistermocha has quit [Read error: Connection reset by peer]
<nictrasavios>
TL;DR: Mr. Bones makes a few methods that makes it easy to load all .rb files from a subdirectory with the same name as the class name. I have four of these classes, and I C/P-ed his code into each one. This feels... wrong. So, I'd like to externalize the methods and have each class call it to require their subfiles
<shevy>
well
<shevy>
the require code is not needed in quite that way IMO
<shevy>
the, in my opinion, best, is to structure and install like a gem
aryaching has joined #ruby
MrBusiness3 has quit [Ping timeout: 272 seconds]
<shevy>
for getting the absolute paths to your gem, there are several ways - one that I use is to define a project-specific constant e. g. BASE_DIR = RbConfig::CONFIG['sitelibdir']+'/name_of_the_gem_here/'
mistermo_ has joined #ruby
A124 has joined #ruby
<shevy>
when you have two files like lib/web.rb and lib/main.rb
djbkd has quit [Ping timeout: 240 seconds]
<shevy>
you could do, if main.rb depends on web.rb, this: require 'name_of_your_gem_here/web.rb'
<shevy>
what is the callers self btw? is that caller()?
dionysus69 has joined #ruby
djbkd has joined #ruby
tomchapin has quit [Client Quit]
postmodern has joined #ruby
diegoaguilar has joined #ruby
diegoaguilar has quit [Max SendQ exceeded]
joneshf-laptop has quit [Ping timeout: 260 seconds]
mistermo_ has quit [Read error: Connection reset by peer]
<nictrasavios>
I couldn't say, Mr. Bones (The gem) generated the project skeleton, I've just been hacking it to work.
mistermo_ has joined #ruby
mistermocha has quit [Ping timeout: 240 seconds]
<toretore>
nictrasavios: how far have you come on your project apart from creating the skeleton?
mistermocha has joined #ruby
xall has quit [Ping timeout: 272 seconds]
<nictrasavios>
There are four parts to the project, 3 seperate API's (A webserver to run the other parts and proccessing incomming HTTP POST requests, Slack's RealTimeMessaging API, Slack slash-command API, and Slack's incomming Webhooks API). So far, I have input from the 3rd party API's feeding into incomming webhooks, and RTM responding to simple things like "Hello", as well as the slash command for "help"
Xeago_ has joined #ruby
misterm__ has joined #ruby
<nictrasavios>
So, I have the basics for each modules down, and the project runs.
mistermo_ has quit [Ping timeout: 244 seconds]
<toretore>
i'd advice getting rid of this mr bones crap, if it's doable
misterm__ has quit [Read error: Connection reset by peer]
<toretore>
follow best practices for naming and placing your files, then require where necessary; making sure they're in the load path is the responsibility of the caller
<nictrasavios>
Alright, so then then how can I do this: Webserver loads init.rb, init calls lib/web.rb, lib/main.rb, lib/commands.rb & lib/config.rb, and then those files load everything in lib/web/*.rb, lib/main/*.rb, etc.
BobTheBlob has joined #ruby
mistermocha has quit [Ping timeout: 240 seconds]
<BobTheBlob>
Bob Here
mattwashere has joined #ruby
<nictrasavios>
By the way, if I'm not following best practices here, let me know. I think I am, from what I can clean from other forums.
<BobTheBlob>
BobTheBlob
<toretore>
nictrasavios: what does "load" and "call" mean here?
<nictrasavios>
Load meanning require, and call meaning require. Sorry - brand new and used to C/C++
justinmrkva has joined #ruby
<toretore>
nictrasavios: any file that depends on another should require that file at the top
<nictrasavios>
Is there a way to make it more dynamic, so that I don't have to require every single file in the subdirectories?
<toretore>
and require should be `require('yourlib/path')`
<toretore>
you should make each require explicit
mattwashere has quit [Remote host closed the connection]
<shevy>
nictrasavios yeah you can do so too, t hat is why I tend to define a toplevel constant sometimes. You can use Dir[] to obtain all .rb files and then just require all of them via that; but otherwise, the really best practice is to require exactly (and only) the parts you need to use in the particular .rb file at hand
<nictrasavios>
Fun, haha. *alright*, I guess I was trying to cheat the system
djbkd has quit [Remote host closed the connection]
<shevy>
it's just four files!
<nictrasavios>
The four files each load between 5 and 25 more
<toretore>
word of advice: if you're new to ruby, be skeptical of any gem or "tip" to make your development easier
<toretore>
they generally only do the opposite
<nictrasavios>
That's why I wanted each of those four to have dynamic loading of a subdirectory with their name on it ;P
<shevy>
one of the main reasons for when I do dynamic requires is when I tend to add new classes at a later time, when you then add like +30 new classes in a project, it's easier to just do a dynamic require since you can't forget anything that way
dhruvasagar has joined #ruby
<nictrasavios>
That's exactly what I'm doing >.<
<toretore>
it's not difficult to add a require to a file...
timanema has quit [Ping timeout: 260 seconds]
doubledouble has quit [Ping timeout: 250 seconds]
aep-shoutlet has quit [Quit: Connection closed for inactivity]
d10n-work has joined #ruby
moeabdol has quit [Quit: WeeChat 1.4]
emiltin has joined #ruby
<justinmrkva>
Just had to mention this strange tip. I was going through a codebase and saw this: `warn "WA"+"RN: message..."` At first it appears to be a Daily WTF style antipattern, but it does one useful thing: it prevents WARN from showing up in a case-sensitive search unless the warning was actually called. That's assuming that's what the programmer actually intended, of course.
Xeago_ has quit [Remote host closed the connection]
<nictrasavios>
Okay, at least make my life a little easier ;), is there a way to specify the base path of require on a per file basis? So, in web.rb, instead of require 'web/file1' require 'web/file2', etc, and in commands require 'commands/fileA' require 'commands/fileB', just have require 'file1' require 'file2' in web, and require 'fileA' require 'fileB' in commands
<toretore>
yes, but you shouldn't
mistermocha has joined #ruby
solars has joined #ruby
<toretore>
def my_require(f); require "web/#{f}"; end
<nictrasavios>
Shoot, alright - at least tell me why so I don't end up being an idiot?
<toretore>
first of all, overriding require behavior globally for a file? not a good idea
Xiti has quit [Quit: Xiti]
<toretore>
secondly; all your requires should be explicit about what they're doing. it should be easy to see exactly what is being required and from where
mattwashere has joined #ruby
<shevy>
justinmrkva lol
<nictrasavios>
Programming 101 right, explicit rather than implicit. Shoot, foiled again.
neo__ has quit [Remote host closed the connection]
<toretore>
i've never seen anything done that actually improves require
<nictrasavios>
I have a lot to learn about ruby.
neo_ has joined #ruby
<karapetyan>
how can i optimize this
<karapetyan>
return from if (number % from == 0 && number / from == target)
<karapetyan>
return to if (number % to == 0 && number / to == target)
djbkd has joined #ruby
<toretore>
nictrasavios: you can make a file web.rb which contains all the requires for the web directory
<toretore>
then require 'web'
<toretore>
this may or may not make sense or be a good idea for your case
mistermocha has quit [Ping timeout: 250 seconds]
lele has quit [Ping timeout: 244 seconds]
<nictrasavios>
, /bin/init requires /lib/web.rb, I was hoping web.rb could require /lib/web/*.rb ;P
<nictrasavios>
But, if that's bad practice than so be it ;P
<toretore>
you can, but i don't see the point
<shevy>
nictrasavios that setup leads to circular require warnings
djbkd has quit [Remote host closed the connection]
<shevy>
which is another reason why minimal-single require calls to the minimum code required is useful
<nictrasavios>
So, should I do all my requires in init?
<shevy>
for /bin/init, in general, you need nothing more than: require 'name_of_your_gem'
<nictrasavios>
Ah, thank you.
<shevy>
if you ever need more than that, then something was setup incorrectly prior to that
SCHAAP137 has joined #ruby
<nictrasavios>
That is exactly what I'm doing, it's just that there is sort of ... "four gems in one"
<toretore>
here's the guiding principle for requires: i should be able to require *any* file inside your lib and it should: 1) work 2) not drag in a bunch of unrelated stuff
<shevy>
nictrasavios well you can have a look at some other gems if you want to, how they solve it
<shevy>
let me grab some examples from other people
neo_ has quit [Ping timeout: 240 seconds]
<nictrasavios>
Thank you! I've been looking at slack-ruby-bot and slack-ruby-server
<toretore>
1 doesn't work if you put all your requires at the top level and 2 doesn't if you centralize your requires
<nictrasavios>
Yup, exactly the way you guys said to.
<shevy>
this one I think is more common to see, it corresponds to e. g. pry/ subdirectory, and inside that directory, input_lock.rb and so on
<nictrasavios>
So, even though I have 4 /lib/name.rb and four /lib/name/*.rb, I should still always do it explicitly, right?
<shevy>
I'd start with the same way, it is more boring... if you really need dynamic requires, once you know the full path, you can always do Dir[] and get an array with your .rb files back, which you can require Dir[PATH].each etc...
<nictrasavios>
My only holdoff on dyanmic requires is something that I don't even know if its possible.
<BobTheBlob>
bob
SilverKey has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
aegis3121 has joined #ruby
<nictrasavios>
This program has parts that need near 100% uptime, I kinda of wanted to ability to throw *.rb files into one of the /lib/name/ directories have it load them durring runtime
<BobTheBlob>
Has anyone written a differential equation solver?
<shevy>
nictrasavios btw so far I never heard the name of your gem :D
harfangk has joined #ruby
<nictrasavios>
But, I think that dream is 1) stupid, and 2) not worth it.
<nictrasavios>
It's actually not a gem, its a SlackBot that I'm writing to manage marketing and PR within my company
<toretore>
nictrasavios: you are right about both 1 and 2 ;)
mistermocha has joined #ruby
neo_ has joined #ruby
<toretore>
nictrasavios: your deployment strategy should use external tools for these purposes
aryaching has quit [Ping timeout: 276 seconds]
mistermo_ has quit [Ping timeout: 250 seconds]
davedev24 has quit []
<nictrasavios>
We've been using external tools, but due to some ... thing's that I'm probably under NDA abut ... we can't continue to use 3rd party tools like zapier
djbkd has joined #ruby
mistermo_ has joined #ruby
smathy is now known as smathy_afk
<toretore>
you just need something like systemd or supervisord
aryaching has joined #ruby
<toretore>
and probably a load balancer between the apps and the world
smathy_afk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
agentmeerkat has quit [Ping timeout: 276 seconds]
<toretore>
but it's also likely that you don't actually need any of this and that doing a git pull and restart is fine
dionysus69 has quit [Ping timeout: 244 seconds]
misterm__ has joined #ruby
<nictrasavios>
All it is is posting anything sent to our twitter/facebook feeds to a slack channel, posting any new "appointments" with "service people" to a channel, and having PR give a "yes or no" on purposed posts. We were using Zapier to do it, but as we got bigger... well, why pay 250$/month/location for zapier when you can force the development team to make something that can run on a 7$/month heroku server right?
smathy has joined #ruby
neo_ has quit [Ping timeout: 250 seconds]
mistermocha has quit [Ping timeout: 250 seconds]
daivyk has joined #ruby
<nictrasavios>
There are also a few problems that can't be solved using external tools, but I can't talk about them ;P.
macsteps has joined #ruby
<nictrasavios>
Unfortunately, the development team consists f myself, a C++ developer, and another dude who I will only describe as a "spoon with a brain".
mistermo_ has quit [Ping timeout: 250 seconds]
<shevy>
a spoon is very useful!
sp4rrow has joined #ruby
<nictrasavios>
He does help keep me sane!
<toretore>
at least he has a brain
roamingdog has joined #ruby
aryaching has quit [Ping timeout: 272 seconds]
rbr has joined #ruby
<nictrasavios>
Good point, previously the development team consisted of myself and a plush dragon. I wish I was kidding about that, but the dragon has an instagram.
pLaToOn has joined #ruby
djbkd has quit [Remote host closed the connection]
mistermocha has quit [Read error: Connection reset by peer]
haxrbyte has joined #ruby
mistermocha has joined #ruby
e4xit has left #ruby [#ruby]
aeruder has left #ruby ["WeeChat 1.0.1"]
SilverKey has quit [Quit: Halted.]
djbkd has joined #ruby
jhack has quit [Client Quit]
neo_ has quit [Ping timeout: 264 seconds]
jhack has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
sauvin has quit [Read error: Connection reset by peer]
arlek has joined #ruby
ur5us has joined #ruby
skweek has quit [Ping timeout: 246 seconds]
haxrbyte has quit [Ping timeout: 244 seconds]
mistermocha has joined #ruby
snebel has joined #ruby
<snebel>
I'm actually having a lot of problems trying to install rvm using chef and in the same run install multiple ruby versions then bundle install some repositories..
SilverKey has joined #ruby
mistermo_ has joined #ruby
<nictrasavios>
Does anyone know what's going on with the VCR gem? It seems to be outdated and failing
<snebel>
not looking for very specific answer here but more what;s your preffered way on achieving that
<toretore>
snebel: what's your goal?
<snebel>
install multiple ruby scripts that needs different versions and gemsets
<snebel>
using chef
<toretore>
where?
<snebel>
in a centos 7.1 server
cdg has joined #ruby
<snebel>
i'm trying with rvm
<snebel>
but chef tens to install all the stuff on system ruby
<snebel>
looks like rvm is very tide to the session
<snebel>
and because chef runs all in the same don't load properly all the profile stuff it needs
<toretore>
have you though about running containers instead?
<snebel>
specially bash functions
<snebel>
I'd really like to but my ionfrastructure is still running vm's
mistermocha has quit [Ping timeout: 250 seconds]
<snebel>
and using chef
arlek has quit [Ping timeout: 246 seconds]
<snebel>
centos just provides ruby 2.0.0
BobTheBlob has quit [Ping timeout: 250 seconds]
<snebel>
i need at least 2.1.0 for a chef gem dependency
<adam12>
snebel: After installing RVM, can you manually source the profile changes? or perhaps re-exec current shell?
<snebel>
other scripts runs on 2.2.0
<adam12>
snebel: I'm not familiar with Chef so just throwing out ideas.
<snebel>
yes, it's a good path thanks
<snebel>
yes i'm trying but strlugging all the time with it
<snebel>
then trying to install bundler
mistermo_ has quit [Ping timeout: 250 seconds]
<snebel>
i'm really missing to being able to static compile those ruby scripts...
joneshf-laptop has joined #ruby
<snebel>
but i need to deal with dependencies and interpreter versions..
<adam12>
What about Travelling Ruby?
<jidar>
chef should provide you a way of (either nativly or via some cookbooks) to execute those gem installs under a rvm
<snebel>
Travelling Ruby?
<snebel>
didn't find anything for chef to do so
<snebel>
there is a rvm cookbook but failing all the time
<jhass>
can't tell because of the log issue I mentioned
Spami has quit [Quit: This computer has gone to sleep]
<jhass>
opened I mean
mistermocha has joined #ruby
nankyokusei has quit [Ping timeout: 276 seconds]
mistermo_ has quit [Ping timeout: 250 seconds]
isberg has joined #ruby
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
misterm__ has quit [Ping timeout: 250 seconds]
ta__ has joined #ruby
sp4rrow has joined #ruby
mistermo_ has joined #ruby
ta_ has quit [Ping timeout: 272 seconds]
jetpack_joe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mistermocha has quit [Ping timeout: 250 seconds]
jher has quit [Quit: leaving]
Spami has joined #ruby
solars has joined #ruby
NSABear has quit [Ping timeout: 244 seconds]
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
dionysus70 is now known as dionysus69
Spami has quit [Client Quit]
mistermocha has joined #ruby
roamingdog has joined #ruby
mistermo_ has quit [Ping timeout: 250 seconds]
snath has joined #ruby
sneakers has joined #ruby
MrBusiness3 has joined #ruby
mistermocha has quit [Ping timeout: 264 seconds]
harfangk has quit [Quit: harfangk]
wrkrcoop has quit [Quit: wrkrcoop]
nofxx has joined #ruby
nofxx has joined #ruby
nofxx has quit [Changing host]
mistermocha has joined #ruby
elementaru has joined #ruby
choke has quit [Remote host closed the connection]
mistermo_ has joined #ruby
MrBusiness3 has quit [Ping timeout: 272 seconds]
sumobob has joined #ruby
Xeago_ has quit [Remote host closed the connection]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
misterm__ has joined #ruby
djbkd has quit [Remote host closed the connection]
mistermocha has quit [Ping timeout: 250 seconds]
mistermo_ has quit [Ping timeout: 250 seconds]
Spami has joined #ruby
* hanmac
gains a new hobby in selling apricot seeds at vegans ;P
choke has joined #ruby
<jhass>
?ot hanmac
<ruby[bot]>
hanmac: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
redbaritone has quit [Quit: redbaritone]
misterm__ has quit [Ping timeout: 250 seconds]
karapetyan has quit [Remote host closed the connection]
Spami has quit [Client Quit]
tildes has quit [Ping timeout: 260 seconds]
jhack has quit [Quit: jhack]
nankyokusei has joined #ruby
jhack has joined #ruby
mistermocha has joined #ruby
<nictrasavios>
Where can I find ruby class/module/variable/method/file naming conventions?
<nictrasavios>
!conventions
<nictrasavios>
Nope.
skweek has joined #ruby
SilverKey has quit [Quit: Halted.]
lxsameer has joined #ruby
nankyokusei has quit [Ping timeout: 260 seconds]
karapetyan has joined #ruby
<shevy>
nictrasavios you could look at the style guide from rubocop
bigkevmcd has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<shevy>
I think
aegis3121 has quit [Ping timeout: 252 seconds]
<shevy>
but it is really simple... module Foo; SOME_CONSTANT = 42 ...
elementaru has quit [Remote host closed the connection]
mistermo_ has joined #ruby
<shevy>
like the () in def method definitions
<FernandoBasso>
Yeah, and I don't buy the argument "this language doesn't require ; at the and of the statments". That is the least of my problems when using a programming languages.
<FernandoBasso>
s/and/end/
<ytti>
that is weird thing to say
<ytti>
you can't omit syntax
<ytti>
i think by definition
<ytti>
if it works, it's syntactically corrct
misterm__ has joined #ruby
Guest71073 is now known as Affix
Affix has quit [Changing host]
Affix has joined #ruby
<shevy>
I so often forgot the ; in php
roamingdog has quit [Remote host closed the connection]
<l4v2>
Well there is other formating errors as well, but that’s the content in the file
mistermocha has joined #ruby
ta__ has joined #ruby
<toretore>
l4v2: ok, so `color` isn't defined at the point you're using it
<toretore>
and `Car.find(color)` probably won't make sense either
chipotle has quit [Client Quit]
<smathy>
The only place `color` is defined is in the `test_having` method.
ta_ has quit [Ping timeout: 276 seconds]
<l4v2>
Yeah, they are giving me everything I need already in all of the other tests
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mistermo_ has joined #ruby
nankyokusei has joined #ruby
<l4v2>
they get defined with the create method?
<smathy>
...not that it would matter because `find` only accepts IDs, *and* you're not creating your Cars with any colors, so a finder using colors is never going to find any anyway.
mistermocha has quit [Ping timeout: 250 seconds]
mistermo_ has quit [Read error: Connection reset by peer]
<smathy>
l4v2, whether the color of a car is set during create or not, the identifier `color` is not being initialized. This is not about data in your DB, it's about the ruby identifier denoted by the name `color`
`tim` has joined #ruby
mistermocha has joined #ruby
<smathy>
l4v2, can I suggest that you work through a programming tutorial first, specifically Learn to Program: https://pine.fm/LearnToProgram/
chipotle has joined #ruby
mdw has quit [Quit: Sleeping Zzzzz]
mistermocha has quit [Read error: Connection reset by peer]
mistermocha has joined #ruby
dminuoso has joined #ruby
dc1 has quit [Ping timeout: 272 seconds]
rodfersou has quit [Quit: leaving]
<l4v2>
I already read a Rails book, and most of the well grounded rubyist. I have just yet to do querying.
nankyokusei has quit [Ping timeout: 258 seconds]
<l4v2>
The Active Record is so weird to me
mistermocha has quit [Read error: Connection reset by peer]
<smathy>
l4v2, I'm making this recommendation based on your understanding of this error, of the `color` identifier, and how you're responding to the help people are trying to give you. It's a fundamental concept in programming that you don't seem to have covered yet.
<smathy>
l4v2, the issue you're having with `color` has nothing at all to do with ActiveRecord.
mistermocha has joined #ruby
goodroot has quit [Quit: WeeChat 1.5]
tfitts has quit [Quit: Connection closed for inactivity]
mistermocha has quit [Read error: Connection reset by peer]
<l4v2>
Do you know how to solve this, it’s jsut for fun
<baweaver>
color is undefined
mistermocha has joined #ruby
<baweaver>
find is not an instance method
<baweaver>
it's a class method, so it has no concept of what color is
last_staff has joined #ruby
vale-tudo has quit [Ping timeout: 244 seconds]
<baweaver>
that, and find takes the primary key of the table which is probably not color.
<baweaver>
Car.find_by(color: 'white')
<baweaver>
but seriously, read some tutorials all the way through
FilipeChagas has joined #ruby
jetpack_joe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mistermo_ has joined #ruby
dminuoso has quit [Ping timeout: 272 seconds]
<smathy>
l4v2, yes I know how to solve it, but if you don't understand the sentence: "`color` is undefined" then I can't communicate how to solve it to you.
<l4v2>
Holy cow dude you ar not that smart becuasae I already know that, so what do you actually suggest genius?
<l4v2>
Dealing with people like this always in this field, like I don’t understand that. It’s the closest I can get to the answer
mistermo_ has quit [Read error: Connection reset by peer]
<l4v2>
do I use the find method?
dvinciguerra_ has quit [Ping timeout: 276 seconds]
<l4v2>
Do I even need it?
<aegis3121>
That's...actually been answered a couple of times.
<aegis3121>
<smathy> ...not that it would matter because `find` only accepts IDs, *and* you're not creating your Cars with any colors, so a finder using colors is never going to find any anyway.
mistermocha has quit [Ping timeout: 249 seconds]
<baweaver>
these have all been answered
<baweaver>
repeatedly
<baweaver>
(mainly due to me not reading the entire backlog admittedly)
dionysus69 has quit [Ping timeout: 276 seconds]
<l4v2>
I just started Active Record stuff yesterday, I know you guys have more time than that, that’s why I came here.
<baweaver>
that, and likely you want to be in the #RubyOnRails channel
<baweaver>
l4v2: you have the answers already
diegoaguilar has joined #ruby
<baweaver>
read back on the chat log and try them out.
<l4v2>
Yeah, I have to define color, I tried that, so maybe it is a syntax error, like I said, this is just for learning for the sake of learning.
roamingdog has joined #ruby
AndroidLoverInSF has quit [Quit: Leaving]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<l4v2>
So how do I define it, becuase when I tried to do it with cheetah as the color it dind’t work. So is it just solor?
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mistermocha has joined #ruby
<jhass>
"didn't work" is not anywhere near an adequate problem description
<toretore>
l4v2: if you don't actually like programming, maybe find a job that doesn't require it
<baweaver>
If you cannot read, we cannot help
<baweaver>
toretore: pushing it.
<toretore>
pushing what?
<baweaver>
little bit out of line, assumes too much.
ekinmur_ has quit [Ping timeout: 264 seconds]
mistermo_ has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
<baweaver>
it was stated that they're learning to learn earlier.
<toretore>
<l4v2> This is why I hate programing, I get no joy out of solving things, just want the answer so I can use it going forward.
<l4v2>
bweaver, I did not see your reply, because I was on the other screen, thank you though
<toretore>
this is pretty clear to me
roamingdog has quit [Ping timeout: 240 seconds]
<toretore>
i made the assumption that it was for a job, which i don't know
<l4v2>
It’s jsut so predictable that no one ever jsut answers a question in this field, it’s like a game of clue.
<l4v2>
no, I already said, fun tutorial
<toretore>
but i could substitute job for university and i'd still mean it
<jhass>
l4v2: your question has been answered multiple times
<shevy>
new people start by learning activerecords??
ekinmur has quit [Ping timeout: 276 seconds]
Sypheren has joined #ruby
mistermocha has joined #ruby
<jhass>
l4v2: if you don't understand the answers given, ask about clarification of specific parts of the given answer instead of repeating your initial question.
<l4v2>
New to Active Records, adn I focused more on the Rails part of it too
<Sypheren>
Hello, what IDE's do you guys tend to use?
<jhass>
Sypheren: $EDITOR and $SHELL
<Sypheren>
I use Intellij for Java but it doesn't seem to be cutting it for ruby
<Sypheren>
:<
<baweaver>
Sypheren: Most popular are: Vim, Sublime, Emacs, Rubymine (also Jetbeans), and Atom
<Sypheren>
I see, thank you!
<baweaver>
Only Rubymine is an IDE though.
<l4v2>
I could just say this, what is the exact line of code that solves this test, so that I can use it going forward, the whole line.
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<baweaver>
and then we could say we gave you it already
<l4v2>
But then I have to do the whole song and dance about here’s a clue anyway. Only in this field
misterm__ has joined #ruby
mistermo_ has quit [Ping timeout: 250 seconds]
<baweaver>
the point is to get you to learn for yourself
<Sypheren>
baweaver, why is there such a small number of IDE's for ruby?
<baweaver>
Sypheren Most people don't need one.
<Sypheren>
Is it just not needed, like it is in Java?
<l4v2>
I can learn more basic stuff in less time once I get basic concepts down
<Sypheren>
My coding background is pretty much 99% java 1% python, so I'm used to relying on heavy IDE's
<baweaver>
Sypheren: In Java you need an IDE just to cope with the complexity and AbstractFactoryProxySingletonFactoryBeans
<Sypheren>
hehe, yup
Es0teric has quit [Quit: Computer has gone to sleep.]
<Sypheren>
Java was a pretty good way for me to learn coding though
<l4v2>
There’s a rule for everything in this world
mistermo_ has joined #ruby
<baweaver>
If you like Ruby but want to still run on the JVM look into JRuby and Scala
<Sypheren>
I actually didn't start using an IDE for it until I was forced to use libraries to work faster
<Sypheren>
I credit that to why I learned it well
mistermocha has quit [Ping timeout: 260 seconds]
<shevy>
\o/
<jhass>
l4v2: we're here to help you with your problem if clearly stated as by the channel rules. We're not here to listen to your views about the world or the computer science or programming fields. Please stop that.
<Sypheren>
Oh, whoops
<baweaver>
Sypheren: I avoid using an IDE for much the same reason. It forces me to read and learn the language instead of having things autocomplete for me.
<l4v2>
I learn better when I see the answer after spedning time on it myself, then I can just say what does that mean. If I had the answer I wouldn’t be here asking.
<Sypheren>
Sorry, jhack
<Sypheren>
Er... jhass
<baweaver>
Sypheren: He wasn't referring to you
<Sypheren>
However, I was also doing the same thing
<Sypheren>
:<
<l4v2>
I usually give people the answer and then let them ask questions.
mistermocha has joined #ruby
<Sypheren>
baweaver, but it's great once you learn it and your goal becomes to work fast!
<jhass>
l4v2: well we don't, see the channel rule I linked
<l4v2>
I don’t do the whole bread crumb trail
<baweaver>
Sypheren: that's fair
misterm__ has quit [Ping timeout: 260 seconds]
<l4v2>
And I still don’t see how you guys would solve it exactly? I got the test to pass, but it’s probably not the best way to do it, which is why I asked
<Sypheren>
Once you get the syntax and conventions down, you usually start to focus on the bigger picture and worry about how your code will be read by other people
<jhass>
l4v2: #new2ruby might have a mindest closer to yours, perhaps it's a better avenue for you
<baweaver>
Sypheren: I just built up a lot of shortcuts, macros, and snippets in vim. Used to be a SysAdmin so Vim was where I lived for the longest time.
<Sypheren>
I've heard testing was also pretty big in Ruby and Rails
<jhass>
l4v2: we can't judge whether you solved it correctly without seeing what you did
<l4v2>
I’m just asking someone in the community, maybe not even you to write it how you would do it, so I can compare it to what I did.
misterm__ has joined #ruby
<jhass>
that's the wrong way around
emiltin has quit [Quit: Computer has gone to sleep.]
<Sypheren>
I've wanted to set up macros, but I've never sat down and tried to do it well
<jhass>
show what you accomplished and we can suggest how you can improve it
<pontiki>
too much work
<baweaver>
Sypheren: It is. Look into Rails 4 in Action. Radar and sevenseacat wrote it.
mistermo_ has quit [Ping timeout: 244 seconds]
<Sypheren>
I hang out on #rubyonrails all the time, it's very well written!
<l4v2>
I already did, passed with an error, so I wanted to get rid of the error, the test doesn’t fail
<baweaver>
If you mean @@var, they tend to behave badly on inheritance iirc
<ruby-lang642>
If you run app.rb it returns 5 instead of 2, and I read it's because the class variable @@items is being used by the sub-classes. I read and found that you can use class instance variables, but I'm not quite sure how to implement it. Changing @@items to @items in item.rb (and subsequent files) causes an error
<jhass>
ruby-lang642: you probably discovered why the usage of class variables is discouraged in ruby except for a very few very specific cases
<toretore>
ruby-lang642: are you sure you actually want to "inherit" @@items ? if we disregard the issues with class vars for a moment and assume that it works the way you intend, all these classes will share the same "store"
<ruby-lang642>
shevy: I'm not sure what you mean, could you elaborate?
<toretore>
ruby-lang642: that is; Product.all and Customer.all will return the same
whathappens has quit [Quit: Leaving...]
<ruby-lang642>
toretore: I understand that's the bug now. I don't want to inherit the @@items but I do want the sub classes to inherit the reused behavior, if that makes sense.
sepp2k has quit [Read error: Connection reset by peer]
mistermo_ has joined #ruby
<jhass>
ruby-lang642: so @items being an instance variable now means that each (sub)class has its own distinct version of it
cisco has quit [Quit: Leaving.]
<jhass>
in other words line 4 of item.rb is not magically inherited by its subclasses
<ruby-lang642>
yes, that is also my understanding of class instance variables and inheritance
<ruby-lang642>
oh
<jhass>
ruby-lang642: it's probably best to have a generic add_to_items method in class Item that lazily initializes @items on first access
<toretore>
ruby-lang642: i suggest this: create an accessor Item.items that instantiates an instance variable: def Item.items; @items ||= []; end
<jhass>
and get rid of the @@products and @@customers stuff
<jhass>
toretore: they said they don't want a global store
<ruby-lang642>
my thought was to have a class variable that keeps track of Products, if there are suggestions please let me know and I'll make them
braincrash has quit [Ping timeout: 272 seconds]
neo_ has quit [Remote host closed the connection]
<ruby-lang642>
I'm still reading through the suggestions and trying to understand what is being said
neo_ has joined #ruby
<shevy>
yeah get rid of all @@ as a first step
<shevy>
use @foo and accessor methods to these
solocshaw has joined #ruby
mistermocha has joined #ruby
<ruby-lang642>
shevy: can you explain what you mean by accessor methods for the @foo
<ruby-lang642>
like I know what accessor methods are
postmodern has quit [Ping timeout: 250 seconds]
<jhass>
ruby-lang642: okay it might help a bit to clear up on what classes are in Ruby. They're instances of the class Class, so full blown objects themselves. And like all ruby objects they can have objects and instance variables that belong to just that one instance
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
<jhass>
ruby-lang642: when you do def self.foo you're defining a method, not different from def foo, it just lives somewhere else, in a class that's just for this single object, which is an instance of Class in this case but that's not really relevant
solocshaw has quit [Ping timeout: 250 seconds]
<jhass>
so "class level instance variables" are really not all that different from the instance variables you probably already understand well, they just live in another (implicit) class
mistermocha has quit [Ping timeout: 250 seconds]
diegoviola has quit [Quit: WeeChat 1.5]
<ruby-lang642>
oh okay that makes sense
<ruby-lang642>
that's actually pretty interesting
pawnbox has quit [Ping timeout: 252 seconds]
<jhass>
ok since that went well we might as well go a little bit deeper still
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ruby-lang642>
i'm guessing the scopes between class variables and class level instance variables are different?
<jhass>
>> class Foo; end; Foo.singleton_class.ancestors
<jhass>
so in the above example the first thing to note is the singleton_class method, that gives as implicit class Ruby creates for each and every object as needed
mdw has quit [Quit: Sleeping Zzzzz]
<jhass>
it's the very same object than the first item of its .ancestors
<shevy>
ruby-lang642 accessors are getter and setter methods; like: Items.product = 'black cat'; Items.product # "black cat"
<jhass>
and it's also the place where your "class level instance variables" and "class methods" live
nadir has quit [Quit: Connection closed for inactivity]
<jhass>
they're instance variables and instance methods respectively of said singleton class
biberu has quit []
<jhass>
the next thing we can observe there is that the singleton class there first inherits the singleton classes of the parent classes of its object's class (in this case Class)
ur5us has joined #ruby
<jhass>
and then also the regular ancestor chain of its object's class
<jhass>
this is why child classes inherit "class methods"
karapetyan has quit []
<jhass>
but it's also why "class level instance variables" are not shared
romistrub has quit [Ping timeout: 250 seconds]
rbennace_ has quit [Remote host closed the connection]
<jhass>
just to prove that claim:
<shevy>
ruby-lang642 in theory you could also use things such as: class Items; def product?; @@product; end; end but unless you really need a @@ class variable, prefer the @ variants
postmodern has joined #ruby
<jhass>
>> class Foo; end; class Bar < Foo; end; Bar.singleton_class.ancestors
wilsonc91 has quit [Ping timeout: 276 seconds]
<ruby[bot]>
jhass: # => [#<Class:Bar>, #<Class:Foo>, #<Class:Object>, #<Class:BasicObject>, Class, Module, Object, Kernel, B ...check link for more (https://eval.in/595325)
<jhass>
and to make clear that Class really is _not_ a special case here:
RegulationD has quit [Remote host closed the connection]
nankyokusei has joined #ruby
mistermo_ has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
<ruby-lang642>
okay so I'm rereading what you wrote. In irb/pry, I've executed Foo.ancestors, Foo.singleton_class.ancestors
northfurr has quit [Quit: northfurr]
<ruby-lang642>
before I dive deeper into what you wrote, can you explain the differences of the output?
<ruby-lang642>
=> [Foo, Object, PP::ObjectMixin, Kernel, BasicObject] is different than => [#<Class:Foo>, #<Class:Object>, #<Class:BasicObject>, Class, Module, Object, PP::ObjectMixin, Kernel, BasicObject]
<jhass>
yes, you call it on different Class instances
<jhass>
Foo is an instance of the class Class, Foo = Class.new do end is semantically equivalent to class Foo end
rbr has quit [Ping timeout: 260 seconds]
solocshaw has joined #ruby
<jhass>
so it's a regular object. All Ruby objects have a so called singleton class which you can fetch with .singleton_class
<jhass>
the singleton class is itself just an instance of Class
mistermo_ has quit [Ping timeout: 250 seconds]
solocshaw has quit [Read error: Connection reset by peer]
xlegoman has joined #ruby
frem_ has quit [Quit: Connection closed for inactivity]
nankyokusei has quit [Ping timeout: 264 seconds]
dminuoso has joined #ruby
mistermocha has joined #ruby
<jhass>
so it has its own ancestor chain
cdg has quit [Remote host closed the connection]
<gse>
hey, i'm trying to do something seemingly simple but ... not happening. I have an array of elements ['foo', 'bar'] and the end result should be "foo", "bar" ... I tried ['foo', 'bar'].map { |x| "\"#{x}\"" }.join(',') and that wasn't what I wanted.
<jhass>
gse: I'm unclear on what your expected result is exactly, "foo", "bar" is not a valid Ruby expression
<gse>
actually never mind.. i just realised what i'm doing wrong
l4v2 has joined #ruby
sneakers has quit [Ping timeout: 276 seconds]
<l4v2>
hello
aryaching has quit [Ping timeout: 252 seconds]
spider-mario has quit [Remote host closed the connection]
<jhass>
ruby-lang642: btw if you understand this you deciphered the secret to most of Ruby's "magic" behaviors and it'll probably actually put you ahead in understanding to a lot of already fully productive rubyists ;)
<ruby-lang642>
I appreciate the help, I'm drawing a diagram to better understand this and then I'll respond to your messages.
<Radar>
l4v2: welcome back
djbkd has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
<jhass>
ruby-lang642: sure, take your time, it took me quite some to click too