havenwood changed the topic of #ruby to: Ruby 3.3.0, 3.2.3, 3.1.4 https://www.ruby-lang.org | Rules https://ruby-community.com | Logs https://libera.irclog.whitequark.org/ruby
<gr33n7007h> adam12: https://github.com/adam12/friendly_numbers/blob/master/lib/friendly_numbers/number_to_human_size.rb#L21-L22 shouldn't those values highlighted be 1000.0 considering your converting to {kilo,mega,giga} bytes?
<gr33n7007h> I think that's why it falls short for zayd's example.
<adam12> gr33n7007h: Yes, likely. There's a distinction of kilobyte vs kibibyte, but when I was doing this implementation it was for representing on-disk values and I was copying the hardware vendor at the time.
<adam12> So more accurately, that value is 30.502 GiB.
<gr33n7007h> adam12: ah, now that makes sense for storage. precisely ;)
<adam12> I should probably update it.
<adam12> Or at least allow you to specify the Si unit.
<gr33n7007h> adam12: that's sound great to me! ;)
donofrio__ has joined #ruby
donofrio_ has quit [Ping timeout: 264 seconds]
Guest26nakilon has joined #ruby
<Guest26nakilon> hi
<Guest26nakilon> I have multiple YAML::Store files and I need to implement a single migration operation that would edit them all
<Guest26nakilon> the issue is that if I do, let's say, s1.transaction{ s2.transaction{}; s3.transaction{} } -- if t3 fails it won't rollback t2
<Guest26nakilon> also, if I do s1.transaction{ s2.transaction{ s2.abort } }, it won't abort s1
<Guest26nakilon> the one question is will s1.transaction{ s2.transaction{ s1.abort } } abort both?
<Guest26nakilon> or... was having multiple pstores essentially an impractical idea and I have to switch to a single db?
<Guest26nakilon> or, what if I make a special single db that to wrap them all in its transaction and be careful to close transactions alltogether in the end?
<Guest26nakilon> i.e. super_store.transaction{ s1.transaction{ ... s2.transaction{ ... s3.transaction{ ... } } } } and call only the super_store.abort -- will it be a remedy?
<Guest26nakilon> or should it be a catch/throw
<Guest26nakilon> this throws error
<Guest26nakilon> tap{ next catch(:c)do end.tap{ fail } }
<Guest26nakilon> why this does not?
<Guest26nakilon> tap{ next catch :c do end.tap{ fail } }
<Guest26nakilon> join #ruby-community
<Guest26nakilon> oops
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
brw has quit [Client Quit]
brw has joined #ruby
donofrio_ has joined #ruby
donofrio__ has quit [Ping timeout: 264 seconds]
ken_barber has joined #ruby
karolis has quit [Ping timeout: 240 seconds]
ken_barber has quit [Quit: Client closed]
hightower2 has quit [Ping timeout: 268 seconds]
hamreh has joined #ruby
hamreh has left #ruby [#ruby]
<Guest26nakilon> YAML.dump(nil) is "--- \n" on 2.7.2
<Guest26nakilon> YAML.dump(nil) is "---\n" on 2.7.8
<Guest26nakilon> ..(
<Guest26nakilon> so it's https://github.com/yaml/libyaml/pull/186 but how do I know the correspondent ruby version and if it's plarform-consistent
konsolebox has joined #ruby
Guest26nakilon has quit [Ping timeout: 250 seconds]
_ht has joined #ruby
bovis has quit [Ping timeout: 268 seconds]
grenierm has joined #ruby
user71 has joined #ruby
reset has quit [Quit: reset]
cxl has quit [Read error: Connection reset by peer]
Furai has quit [Quit: WeeChat 4.2.2]
cxl has joined #ruby
Furai has joined #ruby
gaussianblue has joined #ruby
xdminsy has joined #ruby
nmollerup has joined #ruby
sarna has quit [Ping timeout: 256 seconds]
grenierm has quit [Ping timeout: 250 seconds]
sarna has joined #ruby
TomyWork has joined #ruby
hightower2 has joined #ruby
graaff has quit [Quit: Leaving]
Guest26 has joined #ruby
<Guest26> Hope everyone's peachy this morning :-)
<Guest26> Was just wondering how many devs here are getting more involved in Rust, and how many find themselves rewriting some or all of their Ruby apps (or RoR) to Rust?
Guest66 has joined #ruby
Guest20 has joined #ruby
Guest20 has quit [Quit: Client closed]
Guest18 has joined #ruby
Guest89 has joined #ruby
Guest89 has quit [Client Quit]
Guest66 has quit [Quit: Client closed]
Guest76 has joined #ruby
Guest76 has quit [Client Quit]
mkoncek has joined #ruby
<mkoncek> in `void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);` what is the meaning of the returned int from the callback? the documentation says nothing about it
timpani has joined #ruby
timpani has quit [Quit: Client closed]
Guest26 is now known as shaghomey
Guest18 has quit [Quit: Client closed]
shaghomey has joined #ruby
shaghomey has quit [Changing host]
user71 has quit [Quit: Leaving]
karolis has joined #ruby
Linux_Kerio has joined #ruby
<mkoncek> thanks
<konsolebox> shaghomey: Can't answer your question since I don't have an app, but translating Ruby code to Rust for me is not so straightforward. I'd look at other languages like C# first.
<shaghomey> Thanks. Since you mentioned C#, may I ask whether you'd go with Java?
<shaghomey> (ie, what your reasons would be for chosing the one over the other)
<konsolebox> shaghomey: I'm not sure. I feel so unproductive with Java. That's just me.
<shaghomey> Interesting. Thanks for that info.
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 268 seconds]
rvalue- is now known as rvalue
donofrio__ has joined #ruby
donofrio_ has quit [Ping timeout: 268 seconds]
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
shaghomey has quit [Quit: Client closed]
osc4rpt has quit [Ping timeout: 268 seconds]
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
osc4rpt has joined #ruby
karolis has quit [Ping timeout: 260 seconds]
xdminsy has quit [Read error: Connection reset by peer]
shaghomey has joined #ruby
xdminsy has joined #ruby
karolis has joined #ruby
shaghomey has quit [Quit: Client closed]
osc4rpt has quit [Ping timeout: 252 seconds]
osc4rpt has joined #ruby
pantera has joined #ruby
<adam12> There are things I would rewrite in Rust, but most Rails apps would not qualify.
xdminsy has quit [Remote host closed the connection]
xdminsy has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
fdan has joined #ruby
Guest45 has joined #ruby
Guest45 has quit [Client Quit]
pascal_blaze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pascal_blaze has joined #ruby
pascal_blaze has quit [Ping timeout: 256 seconds]
fdan94 has joined #ruby
fdan79 has joined #ruby
fdan has quit [Ping timeout: 250 seconds]
fdan94 has quit [Ping timeout: 250 seconds]
fdan79 has quit [Quit: Client closed]
<zayd> Is it a bad idea to have a fetch script be only 1 file? I wanted to pack in quite a few features so I'm not sure.
<adam12> zayd: Not sure I follow?
<zayd> adam12: Basically, I'm trying to create something like neofetch with a decent amount of its features along with some other things I'll add in. I know that neofetch does it in just 1 file but it's a bit large (probably due to the ASCII art being in it, which I will have separately). I'm just trying to look for the most efficient way to do this, as this is my first Ruby project.
<zayd> Progress has been moving a bit slow tbh, but it's made me really like using Ruby
<adam12> zayd: If you're distributing it as a Ruby gem, then you can just use the gem distribution mechanism which will support multiple files.
pascal_blaze has joined #ruby
<adam12> zayd: There's a few different ways to package multiple files up, but they all have limitations or may not be maintained. I actually built my own, called rbz, which you could try if your requirements are simple.
<adam12> github.com/adam12/rbz
<adam12> If you have any sort of dependency on another Ruby gem, you might as well just use Rubygems to distribute.
<zayd> adam12: Yeah I was thinking of doing that, plus I have it set up in bundle already. I'm just looking for whether it's best to split the program between multiple files or just have one big rubyfetch.rb inside the bundle.
<adam12> But if you only rely on Ruby stdlib then rbz might work for you.
<adam12> It's a personal call. I've done a single 1000 line file because it felt more natural, but there's no real downside of breaking it up.
<zayd> I guess I can go with a single file for now and if it gets too big to manage I'll split it up
<adam12> Yep
<havenwood> zayd: As soon as it gets awkward in a single class/module and file, I go to RubyGems style structure, like adam12 mentioned.
<havenwood> You can `bundle gem zayd` to generate a "zayd" gem folder with a `lib/` etc.
<zayd> havenwood: this looks like what bundle did already so I guess it will be easy to convert
<zayd> the main file is in lib/ already
<havenwood> zayd: Perfect.
pascal_blaze has quit [Ping timeout: 255 seconds]
donofrio_ has joined #ruby
donofrio__ has quit [Ping timeout: 240 seconds]
donofrio__ has joined #ruby
donofrio__ has quit [Max SendQ exceeded]
donofrio__ has joined #ruby
donofrio_ has quit [Ping timeout: 268 seconds]
jess has joined #ruby
<adam12> warning: It seems your ruby installation is missing psych (for YAML output).
<adam12> To eliminate this warning, please install libyaml and reinstall your ruby.
<adam12> `check_version_conflict': can't activate psych-5.1.1.1, already activated psych-5.1.2 (Gem::LoadError)
karolis has quit [Ping timeout: 268 seconds]
<adam12> Totally wrong...
konsolebox has quit [Ping timeout: 246 seconds]
pascal_blaze has joined #ruby
Arsen has quit [Ping timeout: 260 seconds]
pascal_blaze has quit [Ping timeout: 252 seconds]
mkoncek has quit [Ping timeout: 260 seconds]
konsolebox has joined #ruby
bovis has joined #ruby
Arsen has joined #ruby
pascal_blaze has joined #ruby
niv has quit [Quit: Powered by LunarBNC: https://LunarBNC.net]
niv has joined #ruby
pascal_blaze has quit [Ping timeout: 256 seconds]
gaussianblue has quit [Quit: leaving]
pantera has quit [Remote host closed the connection]
pascal_blaze has joined #ruby
pascal_blaze has quit [Ping timeout: 268 seconds]
osc4rpt has quit [Ping timeout: 268 seconds]
osc4rpt has joined #ruby
pascal_blaze has joined #ruby
pascal_blaze has quit [Ping timeout: 255 seconds]
Guest6 has joined #ruby
<Guest6> Has anyone gotten netbeans 21 working with jruby if so could someone point me to where to load tje plugin Thanks
ken_barber has joined #ruby
fdan has joined #ruby
Guest6 has quit [Quit: Client closed]
___nick___ has joined #ruby
xdminsy has quit [Remote host closed the connection]
fdan has quit [Quit: Client closed]
xdminsy has joined #ruby
pascal_blaze has joined #ruby
<adam12> I love how having activesupport installed busts everything else.
<adam12> Actually, the railstie is enough to do it.
pascal_blaze has quit [Ping timeout: 256 seconds]
dannyAAM has quit [Max SendQ exceeded]
<havenwood> adam12: Good call that it should be fixed. It'd be nice to make an `AlreadyActivatedError < Gem::LoadError` that Bundler can use in the two places it has "already activated" `Gem::LoadError`s. https://github.com/rubygems/rubygems/blob/v3.5.9/lib/rubygems/errors.rb
<adam12> havenwood: I was musing about that too. I kind of hate that they inherited from LoadError for that.
<adam12> (or at least, I think they did)
<havenwood> adam12: Yeah, they did.
<havenwood> adam12: Well, from Gem::LoadError, which inherits from LoadError.
<adam12> Right.
<havenwood> But in RubyGems error.rb there are other subclass errors, and this deserves its own.
<adam12> This is on a non-bundler project that I encountered it.
dannyAAM has joined #ruby
<havenwood> Then you'd not have to match? on message content, which would be nice.
<adam12> You'll see it in Discord but this was the trigger (which I'm seething about already): ruby -rminitest/autorun -e 'true'
<havenwood> adam12: Yeah, they're rescuing LoadError, which is catching Bundler raising the Gem::LoadError < ::LoadError.
<havenwood> being able to do a `rescue AlreadyActivatedError` ahead of the `rescue LoadError` seems ideal.
<adam12> Agreed.
xdminsy has quit [Remote host closed the connection]
pascal_blaze has joined #ruby
konsolebox has quit [Quit: .]
pascal_blaze has quit [Ping timeout: 245 seconds]
<adam12> Just made this repo public. I wonder if it's worth exploring as making into a gem. https://github.com/adam12/time_expr/blob/main/lib/time_expr.rb
<[0x1eef]> It is nice to have slim alternatives like that.
<[0x1eef]> Also a nice API :)
<adam12> Thanks :) I wasn't sure where it was going at the time but found it while spelunking for something else.
<adam12> I made it into a gem just to hold the name for now. I might keep exploring it since I recreate this for every project.
<[0x1eef]> TimeExpr { } is cool. Reminds me of Sequel's where with a block.
<adam12> I always thought it might be nice to have an alias to `T`.
<adam12> Yes! Very similar, and somewhat inspired by it maybe.
<adam12> I think Sequel calls it an expr... so a lot of overlap.
<[0x1eef]> There's also 'expr' at the shell :)
<adam12> Oh, right!
<adam12> `T::Days[4].from_now`. `T { weeks(4) + days(2) }.from_now` Mmmm.
<adam12> I tried some other math libraries but they just never worked for me. I'm not a big fan of a DSL but I like how Sequel did it.
<[0x1eef]> T would be nice if it was a library for your domain alone but might be too generic for common usage.
<adam12> I think I stopped it because I found Ruby coercion annoying. I found some older pleas to unify the protocol but I think they were ignored.
<adam12> I'd presume T would be opt-in, similar to how S in Sequel is.
<[0x1eef]> Nice. That must be the first rubygem I've seen use refinements.
<[0x1eef]> It has a decent interface for opting in too.
Linux_Kerio has quit [Ping timeout: 260 seconds]
pascal_blaze has joined #ruby
ken_barber has quit [Quit: Client closed]
pascal_blaze has quit [Ping timeout: 260 seconds]
szkl has joined #ruby
pascal_blaze has joined #ruby
___nick___ has quit [Ping timeout: 260 seconds]
jmjl- has joined #ruby
jmjl has quit [Ping timeout: 246 seconds]
meimei has quit [Ping timeout: 268 seconds]
pascal_blaze has quit [Ping timeout: 255 seconds]
meimei has joined #ruby
_ht has quit [Remote host closed the connection]
Al2O3 has quit [Ping timeout: 255 seconds]
TomyWork has quit [Ping timeout: 260 seconds]
pascal_blaze has joined #ruby
xdminsy has joined #ruby
Vonter has quit [Ping timeout: 268 seconds]
pascal_blaze has quit [Ping timeout: 246 seconds]
CrazyEddy has quit [Remote host closed the connection]
Aminda has quit [Read error: Connection reset by peer]
Aminda has joined #ruby
pascal_blaze has joined #ruby
pascal_blaze has quit [Ping timeout: 260 seconds]
pascal_blaze has joined #ruby
Al2O3 has joined #ruby
pascal_blaze has quit [Ping timeout: 245 seconds]
pascal_blaze has joined #ruby
pascal_blaze has quit [Ping timeout: 240 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
sagax has joined #ruby
karolis has joined #ruby
jas-maelstrom has quit [Quit: Leaving]
karolis_ has joined #ruby
karolis has quit [Ping timeout: 252 seconds]
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby