32NABEVQJ has quit [Remote host closed the connection]
taylorrf has quit [Ping timeout: 265 seconds]
tunaCanBruh has joined #ruby-lang
fujimura has joined #ruby-lang
tunaCanBruh has quit [Ping timeout: 246 seconds]
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
riotjones has joined #ruby-lang
fujimura has quit [Ping timeout: 272 seconds]
riotjones has quit [Ping timeout: 250 seconds]
piotrj has joined #ruby-lang
Senjai has quit [Changing host]
Senjai has joined #ruby-lang
gix has quit [Ping timeout: 245 seconds]
piotrj has quit [Remote host closed the connection]
tenderlo_ has joined #ruby-lang
tenderlo_ has quit [Remote host closed the connection]
gwendall has quit [Remote host closed the connection]
gwendall has joined #ruby-lang
gix has joined #ruby-lang
tenderlove has quit [Ping timeout: 245 seconds]
gwendall has quit [Ping timeout: 272 seconds]
lytol has joined #ruby-lang
arBmind has joined #ruby-lang
lytol has quit [Ping timeout: 265 seconds]
kyb3r_ has joined #ruby-lang
ozialien has joined #ruby-lang
godzillaenlacasa has quit [Quit: Computer has gone to sleep.]
nathanstitt has quit [Quit: I growing sleepy]
Mon_Ouie has quit [Ping timeout: 264 seconds]
AKASkip has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
slawrence00 has joined #ruby-lang
arBmind has quit [Quit: Leaving.]
postmodern has quit [Quit: Leaving]
Lewix has quit [Remote host closed the connection]
Lewix has joined #ruby-lang
Lewix has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
Lewix has quit [Ping timeout: 244 seconds]
godzillaenlacasa has joined #ruby-lang
allomov has joined #ruby-lang
godzillaenlacasa has quit [Client Quit]
martinbmadsen has quit [Read error: Connection reset by peer]
robbyoconnor has quit [Ping timeout: 252 seconds]
ozialien has quit [Read error: Connection reset by peer]
fujimura has joined #ruby-lang
fujimura has quit [Ping timeout: 255 seconds]
bruno- has joined #ruby-lang
ghostpl_ has joined #ruby-lang
Miphix has joined #ruby-lang
bruno- has quit [Ping timeout: 272 seconds]
ghostpl_ has quit [Ping timeout: 265 seconds]
hahuang65 has joined #ruby-lang
nedp has quit [Remote host closed the connection]
taylorrf has joined #ruby-lang
lytol has joined #ruby-lang
piotrj has joined #ruby-lang
tkuchiki_ has joined #ruby-lang
tkuchiki has quit [Ping timeout: 255 seconds]
taylorrf has quit [Ping timeout: 245 seconds]
tunaCanBruh has joined #ruby-lang
martinbmadsen has joined #ruby-lang
tunaCanBruh has quit [Ping timeout: 246 seconds]
AKASkip1 has joined #ruby-lang
allomov has quit [Remote host closed the connection]
AKASkip has quit [Ping timeout: 250 seconds]
piotrj has quit []
bb010g has joined #ruby-lang
tkuchiki_ has quit [Read error: Connection reset by peer]
tkuchiki has joined #ruby-lang
Guest123456666 has joined #ruby-lang
dellavg_ has joined #ruby-lang
jefus has quit [Ping timeout: 252 seconds]
<Guest123456666>
so I'm sorting through a hash of array of hashes and I need help accessing the data, if anyone would be so kind to query me and I can you show what I've been workin on
<havenwood>
Guest123456666: Show us a Gist of what you have so far and what you'd like?
<Guest123456666>
sure, give me a sec
apeiros_ has quit [Read error: Connection reset by peer]
ur5us has joined #ruby-lang
apeiros_ has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
apeiros__ has joined #ruby-lang
djbkd_ has joined #ruby-lang
apeiros has quit [Ping timeout: 256 seconds]
apeiros_ has quit [Read error: Connection reset by peer]
apeiros has joined #ruby-lang
ur5us has quit [Ping timeout: 256 seconds]
skade has joined #ruby-lang
piotrj has joined #ruby-lang
apeiros_ has joined #ruby-lang
apeiros_ has quit [Client Quit]
apeiros__ has quit [Ping timeout: 256 seconds]
apeiros_ has joined #ruby-lang
allomov has joined #ruby-lang
auzty has quit [Ping timeout: 245 seconds]
apeiros__ has joined #ruby-lang
apeiros__ has quit [Read error: Connection reset by peer]
djbkd_ has quit []
apeiros_ has quit [Ping timeout: 256 seconds]
apeiros has quit [Remote host closed the connection]
charliesome has quit [Quit: zzz]
auzty has joined #ruby-lang
apeiros has joined #ruby-lang
lytol has quit [Remote host closed the connection]
saramic_ has quit [Remote host closed the connection]
AugustoCesar has quit [Read error: Connection reset by peer]
AugustoCesar has joined #ruby-lang
fujimura has joined #ruby-lang
Integralist has joined #ruby-lang
piotrj has quit [Remote host closed the connection]
malconis has joined #ruby-lang
RitterJack has joined #ruby-lang
piotrj has joined #ruby-lang
vondruch_ has joined #ruby-lang
slawrence00 has joined #ruby-lang
vondruch has quit [Ping timeout: 256 seconds]
vondruch_ is now known as vondruch
enebo has joined #ruby-lang
cmisenas has joined #ruby-lang
oleo is now known as Guest26242
oleo__ has joined #ruby-lang
slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Guest26242 has quit [Ping timeout: 250 seconds]
jo__ has joined #ruby-lang
vondruch has quit [Quit: Ex-Chat]
piotrj has quit [Remote host closed the connection]
Lewix has joined #ruby-lang
Lewix has joined #ruby-lang
vondruch has joined #ruby-lang
cornerma1 has joined #ruby-lang
apeiros_ has joined #ruby-lang
cornerman has quit [Ping timeout: 252 seconds]
taylorrf has quit []
centrx has quit [Quit: Shutting down, Please wait...]
wm3|away is now known as workmad3
stardiviner has quit [Ping timeout: 272 seconds]
charliesome has quit [Quit: zzz]
tunaCanBruh has joined #ruby-lang
Integralist has quit [Ping timeout: 265 seconds]
nathanstitt has joined #ruby-lang
Integralist has joined #ruby-lang
futilegames has quit [Ping timeout: 246 seconds]
stardiviner has joined #ruby-lang
havenwood has joined #ruby-lang
michael_mbp has quit [Excess Flood]
michael_mbp has joined #ruby-lang
badeball has quit [Remote host closed the connection]
Lewix has quit []
mattyohe has joined #ruby-lang
riotjones has quit [Remote host closed the connection]
riotjones has joined #ruby-lang
smoitra has quit [Remote host closed the connection]
badeball has joined #ruby-lang
shinnya has joined #ruby-lang
riotjones has quit [Ping timeout: 244 seconds]
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
fujimura has quit [Ping timeout: 245 seconds]
centrx has joined #ruby-lang
rippa has joined #ruby-lang
fujimura has joined #ruby-lang
mkaesz has quit [Remote host closed the connection]
mkaesz has joined #ruby-lang
lele|w has quit [Ping timeout: 252 seconds]
lele|w has joined #ruby-lang
Soviet_Jesus has joined #ruby-lang
mkaesz has quit [Ping timeout: 272 seconds]
j4cknewt has joined #ruby-lang
sarkyniin has quit [Ping timeout: 272 seconds]
dorei has joined #ruby-lang
ta has joined #ruby-lang
mnilsson_ has joined #ruby-lang
mnilsson has joined #ruby-lang
olivierrr has joined #ruby-lang
rikkipitt has joined #ruby-lang
_1_jason has joined #ruby-lang
yxejamir has joined #ruby-lang
dmr8 has joined #ruby-lang
sarkyniin has joined #ruby-lang
smoitra has joined #ruby-lang
sarkyniin has quit [Read error: Connection reset by peer]
sarkyniin has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
|jemc| has joined #ruby-lang
ta has quit [Remote host closed the connection]
allomov has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 250 seconds]
_1_jason has quit [Remote host closed the connection]
ta has joined #ruby-lang
smoitra has quit [Quit: Leaving]
<Soviet_Jesus>
Hello all! At the risk of being rude I'll just jump in: I'm trying to use the ruby CSV library to scan through a CSV and remove all records that contain certain characteristics (I was hoping to use regex, cause its sexy), but for some reason I'm just not getting my head around it. It seems like delete_if would do what I want, but I'm struggling to pass a block to it so I've been using something like x = a.select do ... end. I
<Soviet_Jesus>
become more familiar with Arrays?
<jhass>
well, that's a rather vague question
<jhass>
best is you show some example data, wanted output and your code
<Soviet_Jesus>
ah, sorry. ok,
tvon has quit [Quit: Lost terminal]
mustmodify has joined #ruby-lang
smoitra has joined #ruby-lang
lytol has joined #ruby-lang
sarkyniin has quit [Read error: Connection reset by peer]
fujimura has quit [Remote host closed the connection]
<Soviet_Jesus>
part of the issue is I don't yet have the sample data per se, I'm just trying to get the general technique of removing CSV rows down. but as an example:https://gist.github.com/SuperSovietJesus/6578d5aa5c43fd798c65
lele|w has joined #ruby-lang
fujimura has joined #ruby-lang
<Soviet_Jesus>
also, as for gist: amidoinitrite?
havenn has joined #ruby-lang
<jhass>
Soviet_Jesus: can you please edit the gist to use a separate file for the example data and choose a filename ending in .rb for the ruby part?
fujimura has quit [Read error: No route to host]
<Soviet_Jesus>
of course! sorry
<jhass>
you also seem to mix hard and soft tabs
fujimura has joined #ruby-lang
mustmodify has left #ruby-lang [#ruby-lang]
<jhass>
Soviet_Jesus: okay, that's better, now what results to you expect and what do you get?
havenwood has quit [Ping timeout: 265 seconds]
<jhass>
*do you
<Soviet_Jesus>
Yeah, I've been trying to be more consistent with that. Which is considered better practice?
chinmay_dd is now known as chinmay_dd|away
<jhass>
2 spaces is the ruby community standard
<centrx>
Soviet Jesus is a good name
<Soviet_Jesus>
1 min, gotta get my stuff set back up a tad
sgambino_ has joined #ruby-lang
AugustoCesar has quit [Quit: Leaving.]
<jhass>
no hurry
AugustoCesar has joined #ruby-lang
sankaber has quit [Read error: Connection reset by peer]
<Soviet_Jesus>
its telling me that the 0th element of c is a string, which i was doing just so i could get my head around the objects in play
solars has quit [Ping timeout: 252 seconds]
<Soviet_Jesus>
but the string that it actually is is that freaky CSV::Row string
havenn is now known as havenwood
sgambino has quit [Ping timeout: 246 seconds]
<jhass>
well, you call .to_s on the result of the select
mnilsson_ has quit [Ping timeout: 250 seconds]
mnilsson has quit [Ping timeout: 250 seconds]
<jhass>
so of course it's a string, you make it one there
smoitra has quit [Read error: Connection timed out]
cmisenas has quit [Ping timeout: 252 seconds]
smoitra has joined #ruby-lang
<jhass>
Soviet_Jesus: if you want to inspect and play around with the data, use .inspect and/or the p method (which is like puts but calling .inspect instead of .to_s on the argument). I can also recommend you to get pry
dsaint-pierre has joined #ruby-lang
tvon has joined #ruby-lang
godzillaenlacasa has quit [Quit: Computer has gone to sleep.]
<Soviet_Jesus>
so I updated the gist some, would my goal for trying to make a new CSV be to convert c (which is now an array of CSV::Row) into a table or can it just go straight to a CSV file...looking up pry now
cmisenas has joined #ruby-lang
<Soviet_Jesus>
oh, and is the tabbing better?
futilegames has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
<jhass>
no more hard tabs is nice, but each end should reduce the indentation level by one
momomomomo has joined #ruby-lang
<jhass>
I can also recommend to not fear verbose variable names, "c" and "a" is not good, "columns", "selected_columns", "row" and so on would be better
<jhass>
those help to understand what the code does
<Soviet_Jesus>
whoops, got my blocks confused, should have been a red flag that the final end wasn't justified
ottlikg has quit [Ping timeout: 245 seconds]
fujimura has quit [Ping timeout: 272 seconds]
<Soviet_Jesus>
So if I want to check the whole row, do I need to iterate over row?
fujimura has quit [Remote host closed the connection]
dmr8 has quit [Quit: Leaving]
fujimura has joined #ruby-lang
pipework has quit [Ping timeout: 250 seconds]
<Soviet_Jesus>
So the idea of the situation is we get a list, the columns may not be in the same position each time, and from this list we need to remove all the lawyers as one example.
Integralist has quit [Ping timeout: 256 seconds]
pipework has joined #ruby-lang
<jhass>
so basically drop each row in which a certain string appears?
<Soviet_Jesus>
yeah, I've been beating my head against those pages, to varying degrees of comprehension
<Soviet_Jesus>
yeah!
<jhass>
I probably wouldn't even bother parsing it as CSV then, File.write File.readlines.reject {|line| condition }.join basically
fujimura has quit [Read error: No route to host]
fujimura has joined #ruby-lang
<Soviet_Jesus>
so was i swatting flys with a shotgun?
<Soviet_Jesus>
flies?
<Soviet_Jesus>
regex matches are "truthy" right?
cmisenas has quit [Read error: Connection reset by peer]
__butch__ has joined #ruby-lang
<centrx>
.match returns nil if no match
<jhass>
everything in ruby is truthy, except for false and nil
Snasegh has joined #ruby-lang
lytol has quit []
fujimura has quit [Remote host closed the connection]
<Soviet_Jesus>
now, more generally if I need to do something like combine fields (say, combine first and last name and add a personalized URL) would I use CSV?
fujimura has joined #ruby-lang
<jhass>
yeah
lytol has joined #ruby-lang
cmisenas has joined #ruby-lang
<Snasegh>
Hey, I'm very new to Ruby, but I know a little. I was wondering if this is the correct place to ask a general question?
<Snasegh>
Or if I should refer to some other channel
<jhass>
Snasegh: sure, just ask ;)
AugustoCesar has quit [Remote host closed the connection]
<Snasegh>
As a learning project I'm looking to make an IRC bot to tell me when it's weekend when I ask "When is it weekend?". I'm using Cinch for the project, but I'm a little unsure on how to set the time. I want the bot to respond "It's 3 days and 13 hours to weekend" for example
<jhass>
Snasegh: Check the Time class, Time.now and Time#wday should come in handy
<Snasegh>
Great, thanks
<Snasegh>
jhass ^
__butch__ has quit [Quit: Leaving.]
fujimura has quit [Ping timeout: 245 seconds]
smoitra has quit [Read error: Connection timed out]
bb010g has quit [Quit: Connection closed for inactivity]
<Soviet_Jesus>
So the cleanest way I can think to do that in my head than would be to get the CSV into an array of arrays and then just do...end something to each array...? Would I need to store the edited array in a separate array outside the do block or will the edits be made to original array?
dsaint-pierre has quit [Remote host closed the connection]
<jhass>
I'd open the source and target file simultanous
<jhass>
and write the wanted lines to the target
<Soviet_Jesus>
OOOOHHHH, that method was NOT clicking for me
<Soviet_Jesus>
thank you so much
fujimura has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
sarkyniin has quit [Ping timeout: 264 seconds]
<Snasegh>
I dont need to make a new var for every friday, right? Just checking cause I can't find the part of the Time class I need :p
<jhass>
not sure what you mean by that, but most likely not
<jhass>
I think .wday is all you need for the day :)
AlexAltea has joined #ruby-lang
<Snasegh>
Allright, thanks again. I think I'm just misunderstanding how this works
__butch__ has joined #ruby-lang
amsi has joined #ruby-lang
<Soviet_Jesus>
CSV.open("./source.csv", headers:true, "./dest.csv", headers:true) do |row| ? That seems wrong....
tunaCanBruh has quit [Ping timeout: 250 seconds]
<jhass>
Soviet_Jesus: yeah
<jhass>
you can make more than one call to that method ;)
<Soviet_Jesus>
should I read the IO class docs?
<jhass>
mmh, knowing IO can never harm, but not necessarily for this task
yxejamir has quit [Ping timeout: 250 seconds]
tunaCanBruh has joined #ruby-lang
<Soviet_Jesus>
CSV.open("./source.csv", headers:true) do |sourceR| \n CSV.open("./dest.csv", headers:true) do |destR| destR << sourceR end end ?
agarie has joined #ruby-lang
<Soviet_Jesus>
that seems super wrong
rikkipitt has quit [Read error: Connection reset by peer]
<Soviet_Jesus>
....also I think I appeneded a row to a row
strixd has quit [Quit: 500]
skade has joined #ruby-lang
<Soviet_Jesus>
I think I need to just play around in irb with it a bit...though that pry thing you showed me looks super interesting
rikkipitt has joined #ruby-lang
<jhass>
snake_case, not headlessCamlCase for variable names btw :P
<jhass>
and you would still iterate over the rows of the source of course
sarkyniin has joined #ruby-lang
<Soviet_Jesus>
hilariously enough when I was first starting with ruby I got it in my head that things needed to be headlessCaml, so my first ruby program after hello world converts all the files in a directory from snake to camel
intinig has joined #ruby-lang
fujimura has joined #ruby-lang
wallerdev has joined #ruby-lang
<jhass>
ew, who told you that none sense?
<jhass>
:P
<Soviet_Jesus>
I think i misread, extrapolated, and just ran with it
mnilsson has joined #ruby-lang
mnilsson_ has joined #ruby-lang
scottschecter has quit [Quit: Leaving]
intinig has quit [Ping timeout: 246 seconds]
<Soviet_Jesus>
gem install pry is 404ing for me...that's a windows thing right?
<jhass>
ugh, maybe
<jhass>
but shouldn't afaik
<jhass>
not using that though
mnilsson has quit [Ping timeout: 256 seconds]
mnilsson_ has quit [Ping timeout: 264 seconds]
<Soviet_Jesus>
humm...alright, ill look around
futilegames has quit [Quit: futilegames]
chinmay_dd|away is now known as chinmay_dd
mikecmpbll has quit [Ping timeout: 250 seconds]
elia has quit [Quit: Computer has gone to sleep.]
skade has quit [Read error: Connection reset by peer]
<Soviet_Jesus>
is pry worth putting my rubygems from 2.4.6 to 2.4.4?
wallerdev has quit [Quit: wallerdev]
<jhass>
ugh, but potentially yes
<Senjai>
Soviet_Jesus: Sure, if there are no other side effects
<Senjai>
I would just submit a PR to pry
<Senjai>
though
<Senjai>
instead
<Senjai>
and fork it until the version conflict was fixed
<Senjai>
I HIGHLY doubt prys functionality is reliant on the version of rubygems
ByElektroNeo has joined #ruby-lang
<Soviet_Jesus>
it 404d on 4.4.6 but once i rolled it back it installed
ByElektroNeo has quit [Read error: Connection reset by peer]
<Soviet_Jesus>
yeeeeaaaaaah
<Senjai>
That explains it :P
<Senjai>
y u no linux?
<Soviet_Jesus>
I'm fairly sure I have 2 separate ruby installs, one just sitting on my system and the other is part of a stack, so messing around with the non-stack one shouldn't mess with anything
<Soviet_Jesus>
I'm working on it. Just got a laptop and put xubuntu on it. Sorta at a loss of what to do next considering I don't even really have a windows workflow. Its mostly just notepad++, the browser, cmd, and explorer.
gr1zzlybe4r has joined #ruby-lang
taylorrf has joined #ruby-lang
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
bundler also does it for you if you use that
<Soviet_Jesus>
is there a way to change the irb.bat to launch pry instead of irb?
<gr1zzlybe4r>
ok. is there an article on that topic that i could read somewhere?
<gr1zzlybe4r>
also, thank youi
<Soviet_Jesus>
nvm, I'm just gonna stare at pry.bat and irb.bat till it makes sense
hahuang65 has joined #ruby-lang
agarie has quit []
<jhass>
gr1zzlybe4r: I'm sure if you google ruby load path something comes up, it's not all that hard though
momomomomo has quit [Quit: momomomomo]
<jhass>
$LOAD_PATH is simply a list of directory ruby searches for files to require in
mikecmpbll has joined #ruby-lang
<jhass>
rubygems adds to that variable when a gem is installed
<Snasegh>
I can't wrap my head around this... Think I need to start simpler
<jhass>
Snasegh: .wday returns you a number, 0 is sunday, 1 is monday, 2 is tuesday and so on
wallerdev has joined #ruby-lang
riotjones has joined #ruby-lang
<Snasegh>
jhass: yeah I got that.. Im stuck somewhere else :P I found that I should probably use distance_of_time_in_words since ultimately it should return "It's weekend" between friday 16:00 and monday 08:00
bb010g has joined #ruby-lang
<Snasegh>
But maybe I should use something else instead of Cinch, I dont know
<jhass>
that's active support, you didn't mention you use it ;)
wallerdev has quit [Client Quit]
godzillaenlacasa has joined #ruby-lang
<Snasegh>
Yeah I know :P But I didnt at first
terpo has quit []
<jhass>
you just need to lay out your cases, 5 is friday, so 5 - .wday is the number of days till it's friday, if it's -1 it's saturday and you're in the weekend, if it's 5 it's sunday and you're in the weekend. if it's 4 it's monday and you need to check the hour for whether it's still weekend
wallerdev has joined #ruby-lang
<jhass>
if it's past 16:00 you probably want to substract a day, unless it's friday and so on
<jhass>
find the general case and then all exceptions to it
centrx has quit [Quit: Shutting down, Please wait...]
riotjones has quit [Ping timeout: 250 seconds]
<jhass>
get irb or pry and use Time.at to construct a few test dates
<Snasegh>
Yeah, I can try, thanks
<gr1zzlybe4r>
so i just specify the load path for my local require's and then when i build my gem those requires will be properly handled?
caseydriscoll has quit [Remote host closed the connection]
rikkipitt has quit [Remote host closed the connection]
mkaesz has joined #ruby-lang
_djbkd has joined #ruby-lang
dsaint-pierre has joined #ruby-lang
ItSANgo has quit [Read error: Connection reset by peer]
ghostpl_ has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 252 seconds]
caseydriscoll has joined #ruby-lang
tunaCanBruh has quit [Ping timeout: 256 seconds]
Mon_Ouie has joined #ruby-lang
mkaesz has quit [Remote host closed the connection]
martinbm1dsen has joined #ruby-lang
martinbmadsen has quit [Ping timeout: 250 seconds]
mnilsson_ has joined #ruby-lang
mnilsson has joined #ruby-lang
b_hoffman has quit [Quit: b_hoffman]
mnilsson_ has quit [Ping timeout: 256 seconds]
mnilsson has quit [Ping timeout: 256 seconds]
wallerdev has quit [Quit: wallerdev]
tunaCanBruh has joined #ruby-lang
Integralist has joined #ruby-lang
wallerdev has joined #ruby-lang
konr has joined #ruby-lang
Integralist has quit [Ping timeout: 272 seconds]
futilegames has joined #ruby-lang
<Soviet_Jesus>
pry made me squeal like a little girl when I saw the highlighting
futilegames has quit [Ping timeout: 255 seconds]
<pipework>
You should probably have that cheked out.
Voker57 has quit [Ping timeout: 244 seconds]
<Soviet_Jesus>
nah, its how I know I'm excited
godzillaenlacasa has quit [Quit: Computer has gone to sleep.]
RitterJack has quit [Quit: Quitte]
gr1zzlybe4r has quit [Ping timeout: 250 seconds]
|jemc| has quit [Quit: WeeChat 1.0.1]
momomomomo has joined #ruby-lang
|jemc| has joined #ruby-lang
hahuang65 has quit [Ping timeout: 265 seconds]
slawrence00 has joined #ruby-lang
gwendall has quit [Remote host closed the connection]
Soviet_Jesus has left #ruby-lang [#ruby-lang]
godzillaenlacasa has joined #ruby-lang
benanne has joined #ruby-lang
gwendall has joined #ruby-lang
Donovan has joined #ruby-lang
momomomomo has quit [Ping timeout: 255 seconds]
gwendall has quit [Remote host closed the connection]
allomov has joined #ruby-lang
mskaesz has joined #ruby-lang
momomomomo has joined #ruby-lang
mskaesz has quit [Remote host closed the connection]
mskaesz has joined #ruby-lang
hinbody-work has quit [Quit: leaving]
Dmr has joined #ruby-lang
fuhgeddaboudit has joined #ruby-lang
sarkyniin has quit [Ping timeout: 264 seconds]
fuhgeddaboudit has quit [Client Quit]
fuhgeddaboudit has joined #ruby-lang
fuhgeddaboudit has quit [Client Quit]
fuhgeddaboudit has joined #ruby-lang
ghostpl_ has joined #ruby-lang
ur5us has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
Integralist has joined #ruby-lang
sarkyniin has joined #ruby-lang
_djbkd has quit [Remote host closed the connection]
_djbkd has joined #ruby-lang
gwendall has joined #ruby-lang
yfeldblum has joined #ruby-lang
Integralist has quit [Ping timeout: 245 seconds]
cmisenas has joined #ruby-lang
Donovan has quit [Quit: MOM! HANG UP THE PHON^*&$%*!@#... NO CARRIER]
momomomomo has quit [Ping timeout: 272 seconds]
momomomomo has joined #ruby-lang
Lewix has joined #ruby-lang
fuhgeddaboudit has quit [Quit: Ex-Chat]
fuhgeddaboudit has joined #ruby-lang
b_hoffman has joined #ruby-lang
fuhgeddaboudit has quit [Client Quit]
fuhgeddaboudit has joined #ruby-lang
lsegal has joined #ruby-lang
fuhgeddaboudit has quit [Client Quit]
shawnatyger has joined #ruby-lang
jds has quit [Quit: Connection closed for inactivity]
Lewix has quit []
havenwood has quit [Remote host closed the connection]
mnilsson_ has joined #ruby-lang
mnilsson has joined #ruby-lang
ghostpl_ has joined #ruby-lang
Dmr has quit [Quit: Leaving]
mnilsson_ has quit [Ping timeout: 244 seconds]
mnilsson has quit [Ping timeout: 244 seconds]
arBmind has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
fuhgeddaboudit has joined #ruby-lang
amsi has quit [Ping timeout: 265 seconds]
ghostpl_ has joined #ruby-lang
momomomomo_ has joined #ruby-lang
momomomomo has quit [Ping timeout: 246 seconds]
momomomomo_ is now known as momomomomo
_djbkd has quit [Remote host closed the connection]
ItSANgo has joined #ruby-lang
taylorrf has quit [Remote host closed the connection]
cmisenas has quit [Quit: cmisenas]
ghostpl_ has quit [Remote host closed the connection]
tunaCanBruh has quit [Ping timeout: 250 seconds]
ledestin has joined #ruby-lang
ghostpl_ has joined #ruby-lang
havenwood has joined #ruby-lang
lapide_viridi has joined #ruby-lang
HANJIN has joined #ruby-lang
fuhgeddaboudit has quit [Ping timeout: 256 seconds]
_djbkd has joined #ruby-lang
rikkipitt has joined #ruby-lang
dsaint-pierre has quit [Remote host closed the connection]
ldnunes has quit [Quit: Leaving]
whatasunnyday has joined #ruby-lang
dellavg_ has quit [Ping timeout: 264 seconds]
taylorrf has joined #ruby-lang
<whatasunnyday>
Hey, I'm using Grape (a dsl for rest apis, similar to sinatra). I have a catch all route at the end for 404s. I need to reopen the class and append something above the catch all. Is there anyway to reopen a class and add things to the top? I know the question is a bit unclear so please let me know if it doens't make sense.
taylorrf has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
tunaCanBruh has joined #ruby-lang
<Senjai>
whatasunnyday: Code explains more than words ever will
<Senjai>
As for how grape organizes its "routes" I'm not sure
konr has quit [Quit: Connection closed for inactivity]
<havenwood>
whatasunnyday: My guess from what you've said is Module#prepend, but like Senjai said code would speak volumes!
<Senjai>
I would imaging their stored somewhere, but if they're like rails routes, good luck changing them after setting them
<whatasunnyday>
Module.prepend would be great but since it inherits from Grape::API to get the DSL, that's not possible :(.
<Senjai>
I thought this would happen
<whatasunnyday>
Unless modules can inherit from classes but I didn't think that was possible.
<Senjai>
I dont think opening the class here will work
<whatasunnyday>
Any alternative ideas?
<Senjai>
prepend inserts a module in the classes inheritence chain
<Senjai>
Dont make it so you have to add routes once they've been defined?
Lewix has joined #ruby-lang
Lewix has quit [Changing host]
Lewix has joined #ruby-lang
<Senjai>
These are class methods, they probably add routes to some internal list of routes, or states
caseydriscoll has quit [Remote host closed the connection]
<whatasunnyday>
I don't actually need to reopen the class. Those are just test routes. I just only wanted to define them at test. Right now I have rails.env.test? with an if statement.
<Senjai>
If you had to hack it in, youd probably have to hack it into however they're stored
<whatasunnyday>
hm, yeah that's what i was worried about
<Senjai>
Either way, the API class will be loaded, before you can open it
<Senjai>
so any other class methods you call on it, will take place after the ones that already have.
<Senjai>
Unless you add hooks in the class
mnilsson_ has joined #ruby-lang
mnilsson has joined #ruby-lang
<whatasunnyday>
Sorry, what are hooks into the class?
<whatasunnyday>
nvm, i found it
<Soviet_Jesus>
If i have a gem like pry (and I suppose this applies to irb to some extent) is there any way I can change the path it opens to when I use the batch file to run it?
<Senjai>
whatasunnyday: Odds are, whatever you're trying to do, just isn't a good idea
<Senjai>
If you have to hack around like this
<whatasunnyday>
Senjai, agreed
timanema has joined #ruby-lang
<havenwood>
Soviet_Jesus: like you want to add a path to Pry/irb's LOAD_PATH when you launch it?
<Senjai>
Cant believe I offered help for that question :(
<Senjai>
Worse that I knew the answer
<Soviet_Jesus>
sorry....
<Senjai>
Soviet_Jesus: It's okay :P
<Soviet_Jesus>
I mean, my job is in windows, and I program to be better at my job, so....
<Senjai>
Makes sense
<Soviet_Jesus>
I mean I use bitnami and that seems to keep everything saneish
<Senjai>
We all just hate windows xD
<Senjai>
Most of us at least
<Soviet_Jesus>
oh believe me, I am hating the hell out of windows atm
<Senjai>
Run A linux VM
<Senjai>
xD
lytol has quit [Remote host closed the connection]
cmisenas has joined #ruby-lang
<Soviet_Jesus>
i suppose, i stuck xubuntu on a laptop but didnt really know where to go from there
<Soviet_Jesus>
I think I even managed to get rails on it...I's just that once I found this ruby stack thing the motivation to use the linuxy laptop kinda went away.
whatasunnyday has quit [Quit: Leaving]
<tubbo>
Soviet_Jesus: linux on a laptop != linux on a vm
<tubbo>
it's so much easier to run linux in a vm because you don't have to worry about the window management
<tubbo>
just SSH in and forward through with Vagrant
timanema has quit [Ping timeout: 252 seconds]
<havenwood>
Soviet_Jesus: I just understood what you want. (I think.) Add `Dir.chdir '/working/directory'` to your .pryrc file.
<Soviet_Jesus>
tubbo: Now theres something I can google
gwendall has quit [Remote host closed the connection]
<havenwood>
Soviet_Jesus: For irb same with your .irbrc file. They're just Ruby.
<Soviet_Jesus>
havenwood: what folders would those be in? I'm not super(read: at all) familiar with the innards of ruby yet
<havenwood>
Soviet_Jesus: Typically primarily in your home directory.
cmisenas has quit [Ping timeout: 255 seconds]
<havenwood>
echo "Dir.chdir '/'" >> ~/.pryrc
<havenwood>
or whatever the win equiv is :O
<Soviet_Jesus>
neat, will try
<Soviet_Jesus>
I was about to go meanually looking around my ruby install
riotjones has joined #ruby-lang
<havenwood>
that might actually work in win, i can't recall
<havenwood>
it has `echo` and `>>`, right?
<havenwood>
powershell at least
<Soviet_Jesus>
about to find out.
<Soviet_Jesus>
i've been using cmd...is that not a great idea?
momomomomo_ has joined #ruby-lang
<Soviet_Jesus>
oh wait, thats like, a little more automated than what I'm comfortable with atm
dsaint-pierre has joined #ruby-lang
benanne has quit [Ping timeout: 252 seconds]
<havenwood>
Soviet_Jesus: Just create a .pryrc file in your home dir and to it add: Dir.chdir 'full-path-here'
Bwild has joined #ruby-lang
Iskarlar has joined #ruby-lang
momomomomo has quit [Ping timeout: 252 seconds]
momomomomo_ is now known as momomomomo
riotjones has quit [Ping timeout: 255 seconds]
postmodern has joined #ruby-lang
allomov has quit [Remote host closed the connection]
tcopeland has quit [Ping timeout: 272 seconds]
cmisenas has joined #ruby-lang
<Soviet_Jesus>
whats win32 console
<Soviet_Jesus>
?
rikkipitt has quit [Quit: Leaving...]
<Soviet_Jesus>
oh wait, I think I understand your answer now. is that a script pry will recognize when it starts that just changes the Dir path to whatever?
<Soviet_Jesus>
*when it starts and the script
<havenwood>
Soviet_Jesus: Right. Or Pry-specific stuff like: Pry.config.prompt = Pry::SIMPLE_PROMPT