<wbnns>
How do I calculate the total sum for the value of "sugar" from each object?
<Frankenstein>
hi again. eaten = candies.map { |candy| candy.sugar }.sum
znz_jp has joined #ruby
<al2o3-cr>
wbnns: eaten.sum { |o| o.sugar }
<Frankenstein>
oh, til
<al2o3-cr>
Frankenstein: sum takes a block
<Frankenstein>
listen to al2o3-cr not me
<wbnns>
Hi again. :) Thank you both for your help. It looks like "eaten.sum" doesn't aggregate the total sum from the array (https://dpaste.de/wWkQ). It returns 88 instead of 242.
xco has joined #ruby
mossplix has quit [Remote host closed the connection]
iamayam has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
absolutejam2 has quit [Ping timeout: 268 seconds]
mossplix has quit [Read error: Connection reset by peer]
<al2o3-cr>
wbnns: are you sure?
mossplix has joined #ruby
<wbnns>
I see my error. Apologies. Thank you all again for the assistance.
<Frankenstein>
\o/
<wbnns>
:)
sameerynho has joined #ruby
<al2o3-cr>
wbnns: np ;)
mossplix has quit [Ping timeout: 246 seconds]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
absolutejam2 has joined #ruby
iamayam has joined #ruby
phaul has joined #ruby
iamayam has quit [Ping timeout: 264 seconds]
mre- has joined #ruby
jenrzzz has joined #ruby
dasher00 has joined #ruby
mre- has quit [Ping timeout: 240 seconds]
queip has quit [Ping timeout: 240 seconds]
queip_ has joined #ruby
queip_ is now known as queip
jenrzzz has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
ellcs has joined #ruby
sandstrom has joined #ruby
akemhp has joined #ruby
phaul has quit [Ping timeout: 264 seconds]
akemhp has quit [Ping timeout: 246 seconds]
FlorianFa has joined #ruby
honigkuchen has quit [Quit: Leaving]
phaul has joined #ruby
AJA4350 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akemhp has joined #ruby
queip has quit [Ping timeout: 265 seconds]
queip_ has joined #ruby
queip_ is now known as queip
sylario has joined #ruby
sameerynho has quit [Quit: WeeChat 2.6]
akemhp has quit [Ping timeout: 265 seconds]
Fernando-Basso has quit [Quit: Leaving]
lxsameer has joined #ruby
yasumi2136_ has quit [Remote host closed the connection]
MrCrackPot has quit [Quit: Leaving]
Fira__ has quit [Read error: Connection reset by peer]
Fira__ has joined #ruby
leftylink has quit [Ping timeout: 276 seconds]
leftylink has joined #ruby
sarna has quit [Ping timeout: 240 seconds]
conta has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
jacksoow has joined #ruby
jacksoow_ has quit [Ping timeout: 240 seconds]
xco has joined #ruby
akemhp has quit [Ping timeout: 268 seconds]
yasumi2136 has joined #ruby
MinSrodowiska has joined #ruby
conta has joined #ruby
akemhp has joined #ruby
akemhp has quit [Excess Flood]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akemhp has joined #ruby
conta has quit [Ping timeout: 276 seconds]
mre- has joined #ruby
jenrzzz has joined #ruby
akemhp has quit [Ping timeout: 246 seconds]
conta has joined #ruby
mre- has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
jacksoow has quit [Read error: Connection reset by peer]
cd has joined #ruby
MinSrodowiska has quit [Quit: Bye Bye]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andikr has quit [Remote host closed the connection]
chalkmonster has joined #ruby
MinSrodowiska has joined #ruby
jacksoow has joined #ruby
gnufied__ has joined #ruby
conta has quit [Ping timeout: 240 seconds]
MinSrodowiska has quit [Quit: Bye Bye]
xco has joined #ruby
teclator has quit [Ping timeout: 265 seconds]
akemhp has joined #ruby
gnufied__ has quit [Ping timeout: 250 seconds]
Fira__ has quit [Ping timeout: 276 seconds]
Haris has joined #ruby
<Haris>
hello all
absolutejam2 has quit [Ping timeout: 245 seconds]
<Haris>
how to remove redundant bundler or make system use the latest one
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
teclator has joined #ruby
rwb has quit [Quit: rwb]
rwb has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
rwb has quit [Ping timeout: 276 seconds]
cow[moo] has joined #ruby
akemhp has quit [Remote host closed the connection]
<Haris>
tried this for bundler. it doens't remove old version
<Haris>
old version might have come with rvm
<Haris>
or its pkgs for ruby 2.6.3
schne1der has quit [Remote host closed the connection]
hutch has quit [Ping timeout: 252 seconds]
jacksoow has quit [Read error: Connection reset by peer]
jacksoow has joined #ruby
<NL3limin4t0r>
Haris: Doesn't bundler default to the newest version in new projects? In existing projects you might have to update the bundler version at the bottom of the Gemfile.lock
jacksoow_ has joined #ruby
jacksoow has quit [Ping timeout: 252 seconds]
chalkmonster has quit [Quit: WeeChat 2.6]
jacksoow has joined #ruby
FlorianFa has quit [Quit: Leaving]
jacksoow_ has quit [Ping timeout: 245 seconds]
MinSrodowiska has joined #ruby
schne1der has joined #ruby
gnufied__ has joined #ruby
akemhp has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
AndreYuhai has joined #ruby
jcalla has joined #ruby
<AndreYuhai>
Hey there, I am using capybara, capybara/poltergeist with crawlera proxy. When I am trying to send a request to an HTTP website, everything works fine but when I try, for example, https://google.com then I get StatusFailError
<AndreYuhai>
And if I do not use --ssl-client-certificate-file option then session.visit 'https://google.com' returns success but session.html is just "<html><head></head><body></body></html>"
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
rbruchal has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
mossplix_ has joined #ruby
akemhp has joined #ruby
akemhp has quit [Remote host closed the connection]
<adam12>
AndreYuhai: Without the proxy, can you crawl https?
mossplix_ has quit [Ping timeout: 264 seconds]
Fira__ has joined #ruby
GodFather has joined #ruby
<Haris>
You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError) <--- trying to install redmine 4.0.5. I think earlier version came with rvm, for ruby 2.6.3
MinSrodowiska has quit [Quit: Bye Bye]
mre- has quit [Ping timeout: 265 seconds]
akemhp has joined #ruby
phaul has quit [Ping timeout: 252 seconds]
CalimeroTeknik has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
CalimeroTeknik has joined #ruby
jacksoow has joined #ruby
fphilipe has quit [Quit: WeeChat 2.4]
jacksoow_ has quit [Ping timeout: 265 seconds]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<ruby[bot]>
Haris: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<NL3limin4t0r>
If you're sure you have a new version of bundler installed, which you can check by running `gem list bundler`, you might have to run `bundle update --bundler`.
<Haris>
# gem update --system
<Haris>
Latest version already installed. Done.
mossplix has quit [Ping timeout: 264 seconds]
<NL3limin4t0r>
hmm
<NL3limin4t0r>
What does `gem list bundler` report for the bundler installation?
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
mre- has joined #ruby
ellcs has joined #ruby
<NL3limin4t0r>
Have you already tried a reinstall?
<Haris>
trying
<Haris>
how to reinstall
Nicmavr has joined #ruby
<Haris>
looks like the new version is throwing some error
<NL3limin4t0r>
`gem uninstall bundler -v 2.0.2` then `gem install bundler -v 2.0.2` if I'm not mistaken
<Haris>
# gem uninstall bundler -v 2.0.2
<Haris>
ERROR: While executing gem ... (Gem::InstallError)
<Haris>
gem "bundler" cannot be uninstalled because it is a default gem
<NL3limin4t0r>
sec
queip has quit [Ping timeout: 240 seconds]
queip has joined #ruby
Deesl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Haris>
uninstalled it. reinstalled fresh. getting same error on running bundle update --bundler
<Haris>
this is centos 7
<Haris>
have to run. bbl
Haris has left #ruby [#ruby]
dviola has joined #ruby
hutch has quit [Ping timeout: 264 seconds]
ellcs has quit [Ping timeout: 245 seconds]
i9zO5AP has quit [Quit: WeeChat 2.5]
AJA4351 has joined #ruby
AndreYuhai has quit [Quit: Leaving]
hutch has joined #ruby
Ai9zO5AP has joined #ruby
AJA4350 has quit [Ping timeout: 264 seconds]
AJA4351 is now known as AJA4350
<RougeRR>
fuck me
<RougeRR>
im so tierd at work
<RougeRR>
every time i write something its wrong
<RougeRR>
> stop spending so long on work
<RougeRR>
> having to redo work 3 times when its perfectly acceptable
mre- has quit [Ping timeout: 240 seconds]
<adam12>
Either you're not getting help early enough, or your team isn't providing enough guidance along the way. It's a common problem.
* leitz
agrees with adam12.
queip has quit [Ping timeout: 265 seconds]
queip_ has joined #ruby
queip_ is now known as queip
psilly0 has joined #ruby
<RougeRR>
yeah...its a 2 man team
<RougeRR>
im a self taught jr
<RougeRR>
i duno im fedup with it.
<RougeRR>
ive heard the below about my latest story
<RougeRR>
> dont make it to complex as its only temporary
hutch has quit [Ping timeout: 264 seconds]
<RougeRR>
> make sure its extendable in case we migrated again
<RougeRR>
there was something else but ive forgotten
mossplix has joined #ruby
<RougeRR>
i dont know ive never worked anywhere else
<RougeRR>
programming*
<RougeRR>
worked other stuff in tech
schne1der has quit [Ping timeout: 252 seconds]
<RougeRR>
id like to work somewhere else just to know if its me or them at this point
poontangmessiah has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
nowhere_man has joined #ruby
<leitz>
RougeRR, their two statements are self-contradictory.
<leitz>
And there's an axiom: Nothing is as permanent as a temporary solution.
<leitz>
I'm self-taught as well. Sometimes you have to walk away for a few minutes. Other times you have to walk away from a job.
ellcs has joined #ruby
jacksop has quit []
<RougeRR>
leitz, yeah thats kind of my point
<RougeRR>
ive been both told that its both too brittle as it only allowed the 2 options
<RougeRR>
and that ive over complicated it by allowing it to be extendable
<RougeRR>
the reason i asked about __method__ early was
<RougeRR>
I got accused of trying to be obtuse/over complicating code
<RougeRR>
when its a clear style choice/guide that is really minimal
chalkmonster has quit [Quit: WeeChat 2.6]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr>
RougeRR: fly kick em' in the head, HADOUKEN!
<RougeRR>
would be fun, albeit not conducive to keeping my job haha
AJA4350 has quit [Ping timeout: 268 seconds]
<leftylink>
ohhhhhhhhhh
cow[moo] has joined #ruby
<leftylink>
I thought it'd be like, __foo__, substituting the name of a particular method!!! but now I see that the `method` in there was not to be replaced. it was meant to be __method__
<leftylink>
ohhhhhhhhhhhhh
<leftylink>
now I get it
<al2o3-cr>
\o/ /o\ \o/ /o\ hell yeah!
<leftylink>
I was like "what is this __foo__ thing I have never seen this before!!!"
<NL3limin4t0r>
RougeRR, leitz: Self tought is a loose term imo. I've finished an bachelor's degree ICT, but we mainly used Java for studying purposes. (C for OS and network programming.) However it was never about the programming language, more about application design than anything else. I applied for an internship during the study and self-tought myself Ruby, however a lot of the concepts I had learned came in handy.
rbruchal has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Deesl has joined #ruby
<RougeRR>
haha lefty yeah
<al2o3-cr>
&>> def foo() return __method__, __callee__ end; alias bar foo; [foo, bar]
<RougeRR>
NL3limin4t0r, i did a short course for programming..id say 90% self taught
<RougeRR>
but ive worked in networks/security/support roles for 3-4 years before that
<RougeRR>
yeah im wishing i knew more on the design side
<RougeRR>
am studying a bit
<al2o3-cr>
ruby is stupidly simple
<al2o3-cr>
s/stupidly/beautifully/
mre- has joined #ruby
<NL3limin4t0r>
leftylink: I mostly use __method__ to refer to the method. Mainly for the reason that if I'd ever rename a method I don't have to change it.
jacksoow_ has joined #ruby
<leitz>
NL3limin4t0r, my degree is in bureaucracy, with a C and Pascal class snuck'd in.
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RougeRR>
i dont know
<leitz>
Not much computer theory, though I did electronics support in the military. With vacuum tubes and actual iron ferrite core memory.
jacksoow has quit [Ping timeout: 240 seconds]
<RougeRR>
funky
<RougeRR>
yeah i didnt do a degree
<RougeRR>
drop out haha
<RougeRR>
thought about military at one point in my life, doing comms
<al2o3-cr>
i just don't know what it is about this song.
yann-kaelig has joined #ruby
<NL3limin4t0r>
al2o3-cr: Nah, I've discovered that one about 1-2 months ago, when I heard it on the radio. It makes you wanna dance, that's why it's so likable.
cow[moo] has joined #ruby
<al2o3-cr>
same here. heard it on the radio and like who's this, pretty likable song tbh. it's got me anyway ;)
hiroaki has joined #ruby
<al2o3-cr>
my grammer is atrocious :P
bambanx has joined #ruby
sandstrom has joined #ruby
mjacob has joined #ruby
<mjacob>
is it possible to enable that frozen string literals are enabled for all the ruby files in my project?
<al2o3-cr>
best way is probaly using an environment variable
<NL3limin4t0r>
al2o3-cr: I've also played this one non-stop when it just came out https://youtu.be/IOX30CHr4JY =)
<mjacob>
al2o3-cr: i think this would enable it for all files loaded by the ruby process (including all dependencies of my project)
<al2o3-cr>
mjacob: then i'd just include the magic comment with which files you want in that case
<psilly0>
why do i get tehse errors
<psilly0>
when running a ruby script
<psilly0>
`Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2`
<al2o3-cr>
NL3limin4t0r: not a bad tune tbf
<al2o3-cr>
psilly0: did you try `gem pristine executable-hooks --version 1.3.2`
<al2o3-cr>
only because i didn't think she would sing anything like this.
<al2o3-cr>
i actually quite like her voice in this, believe or not :P
dviola has quit [Ping timeout: 240 seconds]
MinSrodowiska has quit [Client Quit]
bambanx_ has joined #ruby
hutch has joined #ruby
yann-kaelig has quit [Quit: yann-kaelig]
bambanx has quit [Ping timeout: 268 seconds]
drincruz has quit [Read error: No route to host]
drincruz has joined #ruby
rbruchal has joined #ruby
ElFerna has joined #ruby
<psilly0>
is there a way to change rvm version / gemset just in a single ruby script
<psilly0>
or have it always use a certain version
sauvin has quit [Read error: Connection reset by peer]
gix has joined #ruby
<NL3limin4t0r>
psilly0: You can set a Ruby version in your Gemfile `ruby '2.4.1'` for example. When `cd`ing into the directory RVM should use the specified Ruby version in the Gemfile.
mre- has joined #ruby
<NL3limin4t0r>
You should get the message:
<NL3limin4t0r>
> RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
<psilly0>
yes but i have encapsulated my gemfile within my ruby script
ellcs has quit [Remote host closed the connection]
hutch has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
mre- has quit [Ping timeout: 240 seconds]
<psilly0>
NL3limin4t0r: will try this! Thanks DUDE!
<psilly0>
NL3limin4t0r: is that ruby or bash?
bambanx has joined #ruby
yasumi2136_ has quit [Quit: Leaving]
MinSrodowiska has joined #ruby
yasumi2136 has joined #ruby
<psilly0>
sorry its obvilousy bash
yasumi2136 has quit [Client Quit]
yasumi2136 has joined #ruby
mre- has joined #ruby
wymillerlinux has quit [Remote host closed the connection]
wymillerlinux has joined #ruby
mossplix has quit [Ping timeout: 240 seconds]
Jonopoly has joined #ruby
hutch has joined #ruby
akemhp_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mossplix has joined #ruby
queip_ has joined #ruby
akem__ has quit [Ping timeout: 268 seconds]
queip has quit [Ping timeout: 268 seconds]
queip_ is now known as queip
<RougeRR>
would anyone be able to look over my code. yes i know dont ask to ask
bvdw has quit [Read error: Connection reset by peer]
<RougeRR>
im really stumped on how else to do this
infernix has joined #ruby
<_phaul>
is this still the metaprogrammed Logger thing? Or something new?
<RougeRR>
nope
<RougeRR>
same thing
<RougeRR>
as i expected rejected every time
<RougeRR>
i got it looking far better too
bvdw has joined #ruby
mossplix has quit [Remote host closed the connection]
<_phaul>
ah, man, you are having a good time with that. I guess you learn a lot from doing it in so many defferent ways though :)
mossplix has joined #ruby
<RougeRR>
yeah im sort of enjoying
<RougeRR>
or have been
<RougeRR>
but im beginning to tier now
<_phaul>
sorry I'm changing my nick...
<RougeRR>
ive learn a lot
_phaul is now known as phaul
<RougeRR>
but im in shit with work if i dont get it done
<RougeRR>
and its like...how
<phaul>
paste it and see ifI can suggest anything
<RougeRR>
my colleauge thinks the method sshould be able to handle themselves
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<RougeRR>
sanitizing
mossplix has quit [Ping timeout: 276 seconds]
<NL3limin4t0r>
psilly0: It should be executable in ruby. What I'm doing there is replace the current process (Ruby) with a bash command unless the parameter "true" is provided, in which case it skips the line.
<NL3limin4t0r>
In the bash command I set the ruby version, gemset and re-run the script providing "true" the second time around. Otherwise you'd land in an endless loop.
<RougeRR>
i cant see how you wrap the logic to check supported storage locations inside one method
<RougeRR>
and handle error
<RougeRR>
also ignore line 13
<RougeRR>
that should not be there
jeremycw has quit [Ping timeout: 240 seconds]
<RougeRR>
ive thought about using forwarder or delegator modules
<RougeRR>
or something like that
<RougeRR>
but ive got limited/next to no experience with both
<phaul>
(klass || const_get(active_storage)) could be put in a method, as it's repeated twice
<RougeRR>
its already down in a method
<RougeRR>
but yeah could be
<RougeRR>
im mostly concerned with how to do it recursively
<RougeRR>
without the recheck helper method
<RougeRR>
or idk some other way
<RougeRR>
i feel like ive politely been called an idiot for overcomplicating this by both my colleauges
<RougeRR>
'politely'
<RougeRR>
like i think this code is perfectly acceptable tbh
<RougeRR>
might be nice to check if the result is okay and then call recheck
<phaul>
I can't even see the recursion :) wehere is it? where calls recheck. and then?
<RougeRR>
result = send(action, input, const_get(store), true)
<RougeRR>
colleague wants me to completly get rid of that recheck method
<RougeRR>
because its "overly complicated"
<phaul>
I' mean it's not easy to follow... that fore sure
<RougeRR>
ehhh
<phaul>
what is action in that send?
<RougeRR>
look at what is sent in
<RougeRR>
__method__
<RougeRR>
i could kwargs it
<phaul>
ah, it's where
<RougeRR>
thought about that
<RougeRR>
yeah i agree method naming could be fixed
<RougeRR>
method params*
<RougeRR>
i did have this so it was more explicit before phaul. but collauge was like ehh to many lines save here here
jeremycw has joined #ruby
<RougeRR>
ie id get klass
<RougeRR>
then sanitize it
<RougeRR>
then instantiate it etc
<RougeRR>
seperate lines
<phaul>
it's not about naming it's just the two methods calling each other is hard to get you head around. especially if you pass you name to the other for it to use send
<RougeRR>
yeah i can see what you mean
<RougeRR>
i just cant see another way of doing it better
<phaul>
why not just call where(..) in recheck. at least then the recursion becomes more evident
<RougeRR>
because its handling save and where
<phaul>
ah
<RougeRR>
i could put that logic manually into both methods
<RougeRR>
but that seems....dumb?
<RougeRR>
but its the only way i can see of doing what he wants
<RougeRR>
do you have any suggestions on other ways to do this?
MinSrodowiska has quit [Quit: Bye Bye]
<RougeRR>
sorry if i sounded dismissive phaul
<phaul>
right Im starting *slowly* to understand what you are doing...
<RougeRR>
its been a long day
<RougeRR>
phaul, yeah so i have an active storage type
<RougeRR>
and a passive storage array
<RougeRR>
(which includes the active)
<RougeRR>
supported_storage*
<phaul>
nah. no probs. Im being slow too, late here. working all day. I still try to think about ot though...
<RougeRR>
do you want me to add comments
<RougeRR>
i was going to do it before
<RougeRR>
we dont use comments here lol
<phaul>
no, just give us some minutes to digest what's there
<RougeRR>
kk
<RougeRR>
no worries
john2496 has quit []
<RougeRR>
phaul, i had used something like before too
<leftylink>
keep in mind that I have not thought about whether this is possible at all, but you know what I would really like. I agree the mutual recursion may be difficult. so what if it were possible to make only one function recursive, which would be `recheck`. and `save` and `where` need to express to `recheck` how they differ
<leftylink>
I think that would be my idea.
<RougeRR>
just parsing that leftylink
<RougeRR>
thanks for input
<leftylink>
that way, `recheck` doesn't need to `send`. it only needs to call itself
<RougeRR>
that might have bugs in it, but it shows the idea
<RougeRR>
leftylink, im not quite sure what you mean by only making recheck recurrsive?
<RougeRR>
not saying you are wrong, im probably just tierd and not following
<phaul>
I'm having so hard time to work out what this is doing from the code... Can't you describe it in pseudo code and see if someone comesup with some simpler implementation?
<RougeRR>
sure
dostoyevsky has quit [Quit: leaving]
<RougeRR>
its easier that it looks tbh
<RougeRR>
ill comment in
<RougeRR>
which bit are you struggling with btw?
<phaul>
the recusrion with the checking toggle
<RougeRR>
so let me try explain
dostoyevsky has joined #ruby
<RougeRR>
log.save will either raise an exception or return true/false
<RougeRR>
log.where will always return and empty hash, an empty array or raise an exception
<RougeRR>
so we have different success criteria for saving a log and searching for a log
<leftylink>
yeah you know what my problem is, I skipped the part where I bothered to try to understand what the code should be doing, because I didn't feel sufficiently motivated to reason through the mutual recursion
<RougeRR>
i dont even know the term mutual recursion haha
<RougeRR>
storage wise
<RougeRR>
lets say we have 3
<RougeRR>
local, postgres, elasticsearch
<RougeRR>
and they might take slightly different inputs/queries
<RougeRR>
so what we do is, we call recheck with the method and sort the storage so that the active storage is first to be checked
<RougeRR>
if we dont get a success
<RougeRR>
we call the method again with the correct class for the next storage
<RougeRR>
ive tried this so many ways....
<RougeRR>
if someone has a solution that is better, i have no pride any more...
poontangmessiah_ has joined #ruby
<phaul>
so [local, postgres, ealstic].each {|storage| do stuff ; break if succesful? }
<RougeRR>
return/break yes
chalkmonster has joined #ruby
<RougeRR>
ill use break(result, errors) if i decided to do good error handling
<RougeRR>
but for now yes
<RougeRR>
return
<RougeRR>
does that make sense? its ok if not
<phaul>
but... what's the need for recursion?
<phaul>
why not the simple loop I tried?
<RougeRR>
because we want to call @controller.where(query)
<RougeRR>
maybe im tierd and missing it, if you think you have a solution i might just be too blind to see it
poontangmessiah has quit [Ping timeout: 268 seconds]
<RougeRR>
originally i was calling it like
<RougeRR>
@controller.delegate(:where, input)
wymillerlinux has left #ruby [#ruby]
<RougeRR>
and then it called the where/save
<RougeRR>
but that wasnt good enough for my colleauge
MinSrodowiska has joined #ruby
<RougeRR>
s
mre- has quit [Ping timeout: 246 seconds]
<RougeRR>
i thought recursion was the wrong way to do it, hence why i rewrote it without it
sandstrom has quit [Quit: My computer has gone to sleep.]
<RougeRR>
hang on ill get you the non recursion version
<phaul>
yaay
<phaul>
:)
<RougeRR>
my manager and colleauge both said no to it
<RougeRR>
and to me using method_missing
<RougeRR>
tbh im not a fan of method_missing here
<RougeRR>
we know what our methods are
sandstrom has joined #ruby
sandstrom has quit [Client Quit]
<RougeRR>
got it
<RougeRR>
let me just update a bit
ogres has joined #ruby
<adam12>
RougeRR: You didn't have a blog post written about you did you?
<RougeRR>
adam12, haha no
<RougeRR>
why
<adam12>
RougeRR: Let me see if I can find it.
<RougeRR>
i might know the one you mean if its about method_missing mind
<RougeRR>
define_method > method_missing every time
<baweaver>
Though if I was smart I'd have saved all of that indexed by IP so I didn't have to ask more than once.
<baweaver>
Aha, also globals everywhere because I didn't know about block scoping yet.
dviola has quit [Changing host]
dviola has joined #ruby
<RougeRR>
ahh yeahh
<RougeRR>
oh god i started fixing my friends irc framework
<RougeRR>
its python
<baweaver>
To be absolutely 100% fair I was also brand new to Ruby and taught myself with no other Ruby people around.
<RougeRR>
and i....
<baweaver>
Well, really I was the only programmer there.
<RougeRR>
i ripped out over 1000 lines and replaced it with a YAML document and 10 lines of initializaton
<RougeRR>
yeah that is fair baweaver
<baweaver>
I never really rip newer code, I just teach how it could potentially be written instead
<baweaver>
because we all start somewhere
<RougeRR>
yeah
<baweaver>
and there's no faster way to kill someone's drive to program than to say "look how foolish this new person is!"
<RougeRR>
ikwym
<baweaver>
I'm still a fool
* RougeRR
is too
<RougeRR>
im better at networking than i am programming
<baweaver>
and there's nothing wrong with that, it's a journey to get better and improve
<RougeRR>
and now im slowly forgetting all the nitty gritty of that side haha
* RougeRR
nods
<baweaver>
Now if one revels in their foolishness and avoids growth, that's a different matter.
hyperreal has joined #ruby
<baweaver>
Heh, I had one of the directors (2 levels above my head) at work when I joined their org start the conversation with "So you're the new Ruby expert here!"
<RougeRR>
heheh
<RougeRR>
i assume you were not a ruby expert then lol
<baweaver>
Proceed with me iterating 100 reasons why not, and smart brain shutting my mouth before they uttered a single line of it
<RougeRR>
haha
<baweaver>
Smart brain said "accept the compliment and move on"
shansen has joined #ruby
<RougeRR>
glad to hear imposter syndrome keeps on kicking
<baweaver>
I don't call myself an expert because I know people like tenderlove and avdi around
<baweaver>
but what really kicks you is when people start using your name in those sentences and your first reaction is "whoa whoa, hold up a second there"
<RougeRR>
never call ya self an expert
Skarlso has joined #ruby
<RougeRR>
then you have to be THEE expert
<RougeRR>
and THEIR expert lol
<RougeRR>
i think my worst recently was being like "yeah ill just write a script to fix it"
<RougeRR>
to a friend
<RougeRR>
and thought ahh windows has powershell
<RougeRR>
how hard can it be
<RougeRR>
...several hours later of me refusing to give up and install ruby/python
<RougeRR>
turns out some powershell function inheintly expect a string regexp
<RougeRR>
and my string had brackets...
queip has quit [Ping timeout: 265 seconds]
<baweaver>
It's always something.
queip_ has joined #ruby
queip_ is now known as queip
<RougeRR>
yeah, tbh we were doing it over drinks which did not help
<RougeRR>
solution was just using the builtin REGEXP escape
ur5us has quit [Remote host closed the connection]
mre- has joined #ruby
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
mre- has quit [Ping timeout: 268 seconds]
poontangmessiah has joined #ruby
poontangmessiah_ has quit [Ping timeout: 246 seconds]
<RougeRR>
return result if result.present? || logger = @loggers.last
<RougeRR>
or keep track of index
<RougeRR>
and if results.present? || i = @loggers.length
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
Esa_ has quit []
<phaul>
you could remove the if here input = sanitize(input) if logger.name == 'PgLog' with a polymorphic logger.sanitize(input) where each logger sanitizes "the right way"
chalkmonster has joined #ruby
<RougeRR>
mmmm i had considered something like that phaul
<RougeRR>
you would need empty methods or a respond_to?