havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview1: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
Na_Klar has joined #ruby
<adam12> John_Ivan__: This example was for you. <adam12> https://gist.github.com/adam12/b37484e342e14b7c4d2ba25c36577955 super quick example
<John_Ivan__> adam12, thanks.
<John_Ivan__> adam12, have you seen my code?
<John_Ivan__> adam12, https://pastebin.com/Mp5pXzcs
<ruby[bot]> John_Ivan__: as I told you already, please use https://gist.github.com
<adam12> John_Ivan__: Yes, I looked at it.
tomtmym has quit [Quit: Gone.]
buckwheatsuperpo has joined #ruby
buckwheat has quit [Ping timeout: 250 seconds]
<John_Ivan__> adam12, what is your suggestion? go with an orm/sql, or go ahead and make walking skeleton tests?
<adam12> John_Ivan__: I'm still not sure what you're looking to achieve. You provided a C#? example and are not set on writing a lot of tests.
<adam12> John_Ivan__: This is easily achievable in Ruby. Since this is a Ruby channel, that's what I optimized my answer for.
<John_Ivan__> i see.
<John_Ivan__> adam12, yeah, honestly, i don't even know what I want tbh.
shimme12 has joined #ruby
<adam12> John_Ivan__: At a certain point, some tests are not "necessary" or "sufficient", two pieces of criteria one can use to evaluate what tests to write or keep.
<adam12> John_Ivan__: If I'm using PStore/YAML::Store as shown in my example, I might not test aspects of those already covered by their own comprehensive test suites.
<adam12> (in the same way if I was using an ORM I wouldn't test certain aspects of the data being written to the DB)
<John_Ivan__> adam12, I see.
<adam12> Back to your original question, you could ORM/SQL _and_ walking skeleton test. They are not mutually exclusive.
<adam12> I might not ORM/SQL immediately, but marshalling YAML is going to be slow (as is parsing/updating `ini`, likely). Moving to a sqlite database would be an easy enough win to be a bit future-proof.
<John_Ivan__> adam12, understood. thank you.
<John_Ivan__> then I'll move it over to sql
<John_Ivan__> my c# version.
keypresser86 has quit []
<adam12> John_Ivan__: IMHO, follow the quote from Kent Beck
<adam12> Make it work. Make it right. Make it fast.
<John_Ivan__> adam12, I often get stuck in between those. i make it work. i don't know if i make it right. i make it "fast enough" to not bother me.
<adam12> John_Ivan__: It's usually just something you acquire over time.
<John_Ivan__> and then I'm left with question marks thinking to myself
<John_Ivan__> adam12, "i can break this in 20 different ways and I don't trust what I wrote. fuck yes. i'm not gonna use this"
<adam12> But I'd probably try to extract out a small piece and ask for feedback on how to improve it. But code examples go a long way here (obviously).
<John_Ivan__> and then I leave it or re-write it in another language. at least, that's how this little "string/parsing" project has been for me.
<John_Ivan__> adam12, sometimes going for functional language in the hope that the code I write will be forcefully more "correct and concise"
<adam12> Ruby has a really nice text parsing library built in too, if you've never seen it before. https://docs.ruby-lang.org/en/master/StringScanner.html
johnjaye has quit [Read error: Connection reset by peer]
<adam12> (you could build your own .ini parser with it)
<adam12> tho it's maybe way out of your way now. I'd just use built-in's until I couldn't. At least for Ruby, the batteries included stdlib is a huge attraction.
<John_Ivan__> adam12, i merely went with an ini parser because I knew the amount of entries i'll ever write in it won't go over 10k
<John_Ivan__> and because it was simple
<adam12> Makes sense.
johnjaye has joined #ruby
Na_Klar has left #ruby [https://quassel-irc.org - Komfortabler Chat. Überall. ]
<John_Ivan__> adam12, should I bother testing the "database_contains" function? in https://pastebin.com/Mp5pXzcs
<ruby[bot]> John_Ivan__: as I told you already, please use https://gist.github.com
shimme12 has quit [Remote host closed the connection]
<adam12> John_Ivan__: I probably would.
<adam12> John_Ivan__: If you count the branches, there's probably at least 4 different tests in there.
<weaksauce> it's kinda funny how wrong the underscores look in c# like that. you wanted ruby this entire time
<adam12> Heh
<adam12> crashing. laters.
<johnjaye> i forgot how identifiers work in ruby. it's same as c right
caedmon has joined #ruby
caedmon has quit [Client Quit]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
goldfish has quit [Ping timeout: 272 seconds]
<johnjaye> is it invalid to say if 1<2: puts "1<2" end
<johnjaye> ruby isn't accepting this
<ox1eef_> The : part is invalid.
<ox1eef_> if 1 < 2; "1<2"; end
<ox1eef_> That's fine.
<johnjaye> ok. maybe it was allowed at one point? this tutorial i'm reading may be outdated
<ox1eef_> That looks like Python to me.
<johnjaye> ok. it specifically says here to use a colon. so i thought maybe ruby had that just for ease of python users
<johnjaye> also that semicolon version is very odd. feels like bash
<ox1eef_> Usually you would split it over 3 lines and not use semicolons.
<ox1eef_> "1<2" if 1 < 2
<ox1eef_> Another option
<johnjaye> yes i like that one as well
<johnjaye> i don't particularly need any of these, but if someone uses them i need to recognize it
<ox1eef_> The one-liner is common for guards.
<ox1eef_> Paired with an explicit return.
<johnjaye> ok. i see that in perl a lot
<johnjaye> so that makes sense
<leftylink> I suppose if you really wanted to make it work, you could add a little something but it would completely change the meaning
<leftylink> ah no, he thing I'm thinking of needs too many extra parentheses
<leftylink> it defeats the purpose
<leftylink> I apologise for making frivolous claims without having checked them beforehand
buckwheatsuperpo has quit [Ping timeout: 246 seconds]
buckwheatsuperpo has joined #ruby
reset has quit [Quit: reset]
Linux_Kerio has joined #ruby
TomyLobo has quit [Ping timeout: 245 seconds]
caedmon has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 260 seconds]
newspa77 has joined #ruby
caedmon has quit [Ping timeout: 246 seconds]
c10l62 has joined #ruby
buckwheatsuperpo has joined #ruby
c10l6 has quit [Ping timeout: 250 seconds]
c10l62 is now known as c10l6
johnjaye has quit [Ping timeout: 272 seconds]
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
johnjaye has joined #ruby
caedmon has joined #ruby
Artea has quit [Ping timeout: 252 seconds]
Artea has joined #ruby
newspa77 has quit [Remote host closed the connection]
newspa77 has joined #ruby
newspa77 has quit [Remote host closed the connection]
newspa77 has joined #ruby
caedmon has quit [Ping timeout: 252 seconds]
caedmon has joined #ruby
MarvelousWololo has quit [Ping timeout: 258 seconds]
<ox1eef_> adam12: I made good progress on the audio streaming problem. It works, but needs fine-tuned.
<ox1eef_> With that, zZz.
caedmon has quit [Ping timeout: 252 seconds]
newspa77 has quit [Remote host closed the connection]
shokohsc59 has joined #ruby
shokohsc5 has quit [Ping timeout: 272 seconds]
shokohsc59 is now known as shokohsc5
roadie has joined #ruby
roadie` has joined #ruby
roadie` has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 255 seconds]
roadie has joined #ruby
octobear has joined #ruby
MarvelousWololo has joined #ruby
grenierm has joined #ruby
rvalue has quit [Ping timeout: 240 seconds]
rvalue has joined #ruby
roadie has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.92)]
tomtmym has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
hoggin has joined #ruby
MarvelousWololo has quit [Read error: Connection reset by peer]
hoggin has quit [Remote host closed the connection]
dalan03822 has quit [Quit: dalan03822]
dalan03822 has joined #ruby
dalan03822 has quit [Client Quit]
dalan03822 has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
brokkoli_origin has quit [Quit: (Leaving)]
_ht has joined #ruby
crespire has quit [Ping timeout: 245 seconds]
crespire has joined #ruby
brokkoli_origin has joined #ruby
octobear has quit [Ping timeout: 245 seconds]
TomyLobo has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
octobear has joined #ruby
olspookishmagus has quit [Quit: All for nothing]
gr33n7007h has quit [Ping timeout: 272 seconds]
gr33n7007h has joined #ruby
Sankalp has quit [Ping timeout: 245 seconds]
Sankalp has joined #ruby
gr33n7007h has quit [Ping timeout: 272 seconds]
gr33n7007h has joined #ruby
grenierm has quit [Ping timeout: 246 seconds]
perrierjouet has joined #ruby
olspookishmagus has joined #ruby
Linux_Kerio has quit [Ping timeout: 245 seconds]
buckwheatsuperpo has joined #ruby
reset has joined #ruby
markong has joined #ruby
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
teclator has quit [Ping timeout: 240 seconds]
Maisie5 has joined #ruby
Maisie5 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
Linux_Kerio has joined #ruby
markong has quit [Ping timeout: 272 seconds]
<leftylink> well I'll go ahead and share the idea I had that didn't work
<leftylink> pandabot rb p ? (p if 1 < 2) : '1 < 2'
<pandabot> "1 < 2" - https://carc.in/#/r/fgw7
gambol has joined #ruby
<leftylink> as you can see, the extra parentheses ruin it
<leftylink> of course, we observe that the condition there doesn't matter at all anyway
keypresser86 has joined #ruby
<leftylink> and in a surprise to me, if you don't have the parentheses it is a syntax error.
<leftylink> pandabot rb p ? p if p : p
<pandabot> stderr: -e:2: syntax error, unexpected `if' modifier, expecting ':' - exit 1 - https://carc.in/#/r/fgw8
<leftylink> so that is unfortunate
<leftylink> but that is the only way I could think of that you could get a colon to appear after `if` and still have it work
<leftylink> but that syntax error ruins it
<leftylink> an of course I use the word "work" in a flexible manner anyway
<leftylink> since the condition doesn't matter
Jojero has joined #ruby
fakenullie has left #ruby [WeeChat 2.8]
MarvelousWololo has joined #ruby
Jojero has quit [Read error: Connection reset by peer]
Jojero has joined #ruby
caedmon has joined #ruby
jess has joined #ruby
caedmon has quit [Ping timeout: 260 seconds]
gambol has quit [Remote host closed the connection]
Jojero has quit [Remote host closed the connection]
markong has joined #ruby
shokohsc5 has quit [Ping timeout: 245 seconds]
shokohsc5 has joined #ruby
shokohsc50 has joined #ruby
shokohsc5 has quit [Ping timeout: 246 seconds]
shokohsc50 is now known as shokohsc5
glider_ is now known as glider
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
markong has quit [Ping timeout: 272 seconds]
Pixi` has quit [Quit: Leaving]
impomatic has joined #ruby
<impomatic> Hi, I've written a short program to calculate optima numbers. It works fine, but I wondered if anyone has a moment to suggest any improvements please. New to Ruby, so not sure if anything is considered bad practice / style, or if there's a simpler way to implement. https://corewar.co.uk/optima/optima.rb
glider has quit [Quit: ZNC - https://znc.in]
ua_ has quit [Ping timeout: 240 seconds]
glider has joined #ruby
flax has joined #ruby
keypresser86 has quit [Ping timeout: 272 seconds]
<weaksauce> for those kind of heavy algorithm ones that looks fine
<weaksauce> impomatic
<weaksauce> maybe give it a little breathing room
<weaksauce> by adding some empty lines here and there
<impomatic> weaksauce: thank you, it's appreciated. I'll add some whitespace.
flax has quit [Remote host closed the connection]
flax has joined #ruby
<weaksauce> other than that it's hard to make algorithms look like idiomatic ruby
flax has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
impomatic has quit [Quit: https://corewar.co.uk]
___nick___ has quit [Ping timeout: 245 seconds]
ua_ has joined #ruby
crespire has quit [Remote host closed the connection]
crespire has joined #ruby
Kremli30 has joined #ruby
Pixi has joined #ruby
shokohsc56 has joined #ruby
shokohsc5 has quit [Ping timeout: 252 seconds]
shokohsc56 is now known as shokohsc5
keypresser86 has joined #ruby
tomtmym has quit [Quit: Gone.]
_ht has quit [Quit: _ht]
matoro has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
Linux_Kerio has quit [Ping timeout: 272 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
matoro has joined #ruby
matoro has quit [Client Quit]
matoro has joined #ruby
matoro has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
matoro has joined #ruby
matoro has quit [Client Quit]
matoro has joined #ruby
matoro has quit [Client Quit]
matoro has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 272 seconds]
perrierjouet has quit [Quit: WeeChat 4.0.2]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
buckwheatsuperpo has joined #ruby