jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
jpn has joined #ruby
mikecmpbll has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jetchisel has joined #ruby
jpn has joined #ruby
nirvdrum has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
nirvdrum has quit [Ping timeout: 260 seconds]
taiju has joined #ruby
jpn has joined #ruby
nirvdrum has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
mikecmpbll has quit [Ping timeout: 265 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
Al2O3 has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
ramnet has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
Al2O3 has joined #ruby
markong has quit [Ping timeout: 265 seconds]
yosafbridge has quit [Quit: Leaving]
sixecho has quit [Quit: Reconnecting]
sixecho has joined #ruby
ramnet has left #ruby [Leaving]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
yosafbridge has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
taiju has quit [Ping timeout: 244 seconds]
jetchisel has quit [Ping timeout: 244 seconds]
jetchisel has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
<libsys> leftylink: I honestly couldn't understand what you proposed, so I created an example code of what I'm trying to do https://pastebin.com/LA52VZvp
<libsys> the code is somewhat large, but the important thing is not the implementation details, only the test... which tries to stub Net::SMTP#start and #send_message
<leftylink> I see that therefore my suggestion is sort of wrong because I assumed it would be Net::SMTP.start instead of Net::SMTP#start, so it looks like my suggesotin would need a few modifications. honestly in that case I'd just have the test's implementation of #start yield self then, in which case there's no need to create a new object just to define a send_message on it
shokohsc has quit [Ping timeout: 246 seconds]
shokohsc has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 260 seconds]
wra1th has left #ruby [#ruby]
Guest55uy77 has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
Guest55uy77 has quit [Quit: Client closed]
Guest55uy77 has joined #ruby
Guest17543 has joined #ruby
mikecmpbll has joined #ruby
mikecmpbll has quit [Ping timeout: 248 seconds]
reset has joined #ruby
Guest55uy77 has quit [Quit: Client closed]
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
Guest17543 has quit [Quit: Client closed]
skuntee4 has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
skuntee4 has quit [Ping timeout: 244 seconds]
Sankalp has quit [Ping timeout: 250 seconds]
Sankalp- has joined #ruby
Sankalp- is now known as Sankalp
jpn has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
teclator has joined #ruby
ur5us has joined #ruby
perrierjouet has quit [Ping timeout: 265 seconds]
perrierjouet has joined #ruby
ua_ has joined #ruby
kristianpaul has quit [Ping timeout: 265 seconds]
kristianpaul has joined #ruby
Rounin has joined #ruby
Rounin has quit [Changing host]
Rounin has joined #ruby
dionysus69 has joined #ruby
ur5us has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
jpn has joined #ruby
ur5us has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
Jonopoly has joined #ruby
mikecmpbll has joined #ruby
mikecmpbll has quit [Ping timeout: 250 seconds]
sagax has joined #ruby
TomyWork has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
skuntee4 has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
dionysus69 has joined #ruby
skuntee4 has quit [Ping timeout: 268 seconds]
royo25 has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
dionysus69 has quit [Ping timeout: 265 seconds]
darkstardevx has quit [Ping timeout: 268 seconds]
markong has joined #ruby
nirvdrum has joined #ruby
dionysus69 has joined #ruby
mikecmpbll has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
darkstardevx has joined #ruby
jpn has joined #ruby
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
CrazyEddy has quit [Ping timeout: 264 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Al2O3 has joined #ruby
<sam113101> jhass[m]: what is ractor?
<sam113101> I don't even need to share data between the threads
<jhass[m]> Then give them a try!
teclator has quit [Ping timeout: 260 seconds]
Al2O3 has quit [Ping timeout: 265 seconds]
dionysus69 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
<cybertron> question: I have an array list of db models and I wan't to access the model in the list by attribute id, is there any way?
nowaker_ has quit [Remote host closed the connection]
<adam12> cybertron: Sure, but it would help if you would show some code.
Nowaker has joined #ruby
_aeris_ has joined #ruby
aeris has quit [Ping timeout: 258 seconds]
_aeris_ is now known as aeris
<cybertron> adam12: https://pastebin.mozilla.org/PPBNtEQi thats my structure
<adam12> cybertron: And how do you imagine the interface looking?
<cybertron> and I want to get the model by the id attribute
<cybertron> its active record
<adam12> Well, if you want quick and dirty, you can find. array.find { |m| m.id == the-id }
<cybertron> hm yes, possible more dirty but shorter? ;D
<adam12> I might be inclined to make a new object that wraps this one, and has a nice method on it.
<adam12> Well if you're on Ruby 2.7?, you can use numbered params to drop 2 characters. LOL.
<adam12> array.find { _1.id == the-id }
<cybertron> lol ok, yes 2.7
<cybertron> but seems to work :D
<cybertron> thank you
<cybertron> but lesson learned, you can used numbered parameters instead of block variable, nice
teclator has joined #ruby
hrberg has quit [Ping timeout: 246 seconds]
teclator has quit [Read error: Connection reset by peer]
teclator has joined #ruby
aesthetikx has quit [Ping timeout: 265 seconds]
teclator has quit [Ping timeout: 265 seconds]
teclator has joined #ruby
royo25 has quit [Quit: Bye]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
mikecmpbll has quit [Ping timeout: 268 seconds]
mikecmpbll has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
Milos has quit [Ping timeout: 268 seconds]
aesthetikx has joined #ruby
Milos has joined #ruby
_ht has joined #ruby
mikecmpbll has quit [Ping timeout: 252 seconds]
mikecmpbll has joined #ruby
mikecmpbll has quit [Ping timeout: 268 seconds]
Jonopoly has quit [Quit: WeeChat 3.0]
eddof13 has joined #ruby
sgt_chuckles has joined #ruby
Aminda has quit [Remote host closed the connection]
<sgt_chuckles> i have a class using the repository pattern to access db table records, but finding that i'll have to iterate over the table records outside of this class. Feels like im defeating the purpose of the repository pattern by doing this, and wondering if theres a way to iterate over the records while preserving the purpose of this repository class.
dionysus69 has quit [Read error: Connection reset by peer]
Aminda has joined #ruby
<sgt_chuckles> Can anyone lend some advice?
dionysus69 has joined #ruby
<adam12> sgt_chuckles: Example?
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sgt_chuckles has quit [Quit: Client closed]
_aeris_ has joined #ruby
aeris has quit [Ping timeout: 258 seconds]
jpn has quit [Ping timeout: 265 seconds]
_aeris_ is now known as aeris
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
eddof13 has joined #ruby
jpn has joined #ruby
sgt_chuckles has joined #ruby
mikecmpbll has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
sgt_chuckles has quit [Quit: Client closed]
aeris has quit [Quit: ZNC - http://znc.sourceforge.net]
_aeris_ has joined #ruby
_aeris_ is now known as aeris
yellowstone has joined #ruby
mikecmpbll has quit [Ping timeout: 265 seconds]
mikecmpbll has joined #ruby
jpn has quit [Ping timeout: 260 seconds]
jpn has joined #ruby
yellowstone has quit [Remote host closed the connection]
yellowstone has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
nirvdrum has joined #ruby
markong has quit [Ping timeout: 246 seconds]
TomyWork has quit [Remote host closed the connection]
pgib has quit [Ping timeout: 248 seconds]
<libsys> leftylink: yield(self) throws `LocalJumpError: no block given (yield)`
<libsys> :/
<adam12> libsys: show code
<libsys> the relevant part is the test
jpn has joined #ruby
pgib has joined #ruby
<adam12> libsys: Ah yeah. Gross.
mikecmpbll has quit [Ping timeout: 265 seconds]
mikecmpbll has joined #ruby
<libsys> xd
yellowstone has quit [Ping timeout: 252 seconds]
<adam12> libsys: maybe you can capture to block and then block.call instead of yielding.
zoknert has joined #ruby
<adam12> libsys: But this whole thing kind of reeks.
yellowstone has joined #ruby
<adam12> Actually, why are you yielding outside of the method definition?
<adam12> What's the ultimate goal of this code?
<libsys> it's because there's 2 method definitions
<adam12> Is this extracted from something?
<libsys> one is .start (stub_any_instance) and other is (inside of start) send_message
<adam12> IMHO, stop using class methods with that much logic. And then pass in Net::SMTP as a dependency.
<libsys> nope... I just need an easy way to send emails
<adam12> Then you won't need stubbing like you are.
<adam12> You could skip all this and use Pony...
<libsys> yeah... seems like an overkill to me
<libsys> honestly, I think SMTP.send_email is exactly the kind of interface I'd want to use
<libsys> but I can see how this makes testing difficult
zoknert has quit [Ping timeout: 264 seconds]
<adam12> Technically when you're mocing Net::SMTP.start, you're mocking something you dont' own. Which is bad juju.
<adam12> Probably be better if it was divided even more, but I don't have time to continue with it.
Aminda has quit [Ping timeout: 258 seconds]
yellowstone has quit [Remote host closed the connection]
yellowstone has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
TomyLobo has joined #ruby
<TomyLobo> given a modest amount of local variables, what's the ballpark for the levels of recursion I can go. hundreds? thousands?
<TomyLobo> I'm getting a SystemStackError: stack level too deep at something that legitimately recurses quite deep and I wanna know if I built an endless recursion or not :)
<TomyLobo> hmm, it's just 2180 recursive calls. would've expected more ^^
<weaksauc_> i think that's something you can set
<TomyLobo> RUBY_THREAD_VM_STACK_SIZE=10000000
<TomyLobo> i get a segfault at anything much greater than that
hrberg has joined #ruby
Aminda has joined #ruby
<TomyLobo> ah, I found the issue with my code :)
A_Dragon has quit [Killed (A_Dragon (boop))]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
A_Dragon has joined #ruby
yellowstone has quit [Ping timeout: 265 seconds]
Aminda has quit [Remote host closed the connection]
yellowstone has joined #ruby
Aminda has joined #ruby
ur5us has joined #ruby
yellowstone has quit [Read error: Connection reset by peer]
eddof13 has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
_ht has quit [Remote host closed the connection]
<libsys> adam12: Appreciate it.. I'll probably end up doing something like that, given that I still don't have an idea on how can I test my code after a couple days
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
jpn has quit [Ping timeout: 265 seconds]
<TomyLobo> I'm looking for an optimized way to prepend an element to an array/list of < 1000 elements and return the result as an independent copy. So far I found "[element] + array" and "[element, *array]". Which one is faster? Is there an even faster way?
<TomyLobo> to clarify, the input array/list cannot be modified
<TomyLobo> benchmarks are inconclusive
jpn has joined #ruby
<TomyLobo> btw, is there any way to generate an initialize method based on the attr_accessors a class has, or at least with a list of variables instead of having to specify the whole constructor?
<TomyLobo> basically like lombok's @RequiredArgsConstructor: https://projectlombok.org/features/constructor
<TomyLobo> sorry, @AllArgsConstructor
howdoi has joined #ruby
reset has quit [Quit: reset]
<leftylink> I think the initialize will be easy. you could either use define_method, or honestly a regular initialize that takes an *args and iterates over the variables to be set and uses instance_variable_set. the harder part is where to get the list of variables. you could list the instance methods and find any that have var/var= pair and assume that they were made with attr_accessor (could have false positives)
<leftylink> or you could override attr_accessor to store a list
<TomyLobo> so there's nothing pre-made?
<TomyLobo> it's not that important. thought i could use some idiomatic way to do this, but i guess not
nirvdrum has joined #ruby
Guest3354e has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
skuntee4 has joined #ruby
<havenwood> TomyLobo: FWIW, you may be able to get around too deep stack levels by enabling TCO.
<havenwood> I usually just solve the problem differently, but you can eval code with tailcall optimization enabled.
<havenwood> I need to switch this to `require_relative 'foo', optimize_tail: true` or something, but here's an example: https://gist.github.com/havenwood/3c5a5e1476c811460992
<Guest3354e> how save history chat  https://web.libera.chat/# with ruby to file cvs sql
John_Ivan has quit [Read error: Connection reset by peer]
skuntee4 has quit [Ping timeout: 246 seconds]
skuntee4 has joined #ruby
John_Ivan has joined #ruby
<TomyLobo> Guest3354e, i get file and sql, but why cvs?
<TomyLobo> oh you mean csv, right?
<TomyLobo> anyway good luck with that. I'm not helping you do it wrong
<TomyLobo> get a proper client and use its integrated logging feature
Guest3354e has quit [Ping timeout: 252 seconds]
duds- has quit [Quit: Leaving.]
<TomyLobo> and they're gone
<TomyLobo> havenwood, hadn't thought of that, but I'll probably have a difficult time making use of that anyway, since I need to accumulate all those results before passing them up
<TomyLobo> so it wouldn't be a tail call
<TomyLobo> also i got rid of the stack overflows by fixing my code :D
skuntee4 has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
markong has joined #ruby
trunasx has joined #ruby
RickHull has joined #ruby
Sankalp has quit [Ping timeout: 248 seconds]
Sankalp has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
trunasx has quit [Ping timeout: 268 seconds]
Thanzex has quit [Read error: Connection reset by peer]
Thanzex3 has joined #ruby
Rounin has quit [Ping timeout: 264 seconds]
dionysus69 has joined #ruby
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby