<apteryx>
I think because it doesn't evaluate in order
<apteryx>
so 3 == 3 -> true and assigns to a ? perhaps
cartdrige has joined #ruby
<leftylink>
well, = has much lower precednece than ==, so you would need to use parentheses
<leftylink>
but of course it works with the correct parentheses.
<willow>
ruby has ? ternary operator
<willow>
unfortunately no walrus operator like python
leonthemisfit has joined #ruby
joto has quit [Remote host closed the connection]
Linux_Kerio has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
ur5us has joined #ruby
<ox1eef_>
if x = 3 == 3; puts x; end works as expected. if x = (3 == 3); puts true; end is a little clearer, and might help for more complex conditions. Some people recommend avoiding assignment in if altogether though.
aesthetikx has joined #ruby
aestheti1 has quit [Ping timeout: 272 seconds]
Sankalp has quit [Ping timeout: 268 seconds]
_ht has joined #ruby
Sankalp has joined #ruby
Linux_Kerio has quit [Ping timeout: 252 seconds]
<tsujp>
Currently reading the docs for the IO class but in-case it isn't there or I miss it, what's the best way to read from a potentially large file where I might need to go _backwards_ too. I.e. `File.foreach` is not useful here as that only goes _forwards_
<tsujp>
`IO:Buffer#slice` looks useful for this "view" as I can move the start and end around but the `IO:Buffer` does not keep the entire file in memory does it? The docs say `Create a buffer mapped to some file with ::map, then it could be used for reading and writing the underlying file.` so I am assuming it is not copied into memory?
<ox1eef_>
Does seek not help ? My approach would be: File.new('foo.txt', 'r'), and then I'd use seek, alongside reading a given number of bytes.
<jhass[m]>
I'd probably trade some memory usage (keeping things I might need later again in a cache, usually in their parsed/deserialized form) to achieve linear reading though, it's just that much faster I think
Sankalp has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 260 seconds]
<leonthemisfit>
personally I'd say those are both good solutions depending on the specific use case and whether or not it's known in advance what needs to be cached or if it's conditional based on the input file
apteryx has quit [Ping timeout: 252 seconds]
Cata[m]1 has quit [Quit: You have been kicked for being idle]
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
dorian has quit [Remote host closed the connection]
plantman2 has joined #ruby
plantman has joined #ruby
plantman has quit [Ping timeout: 252 seconds]
plantman2 has quit [Ping timeout: 256 seconds]
plantman has joined #ruby
plantman2 has joined #ruby
dorian has joined #ruby
dorian has quit [Remote host closed the connection]
dorian has joined #ruby
plantman2 has quit [Ping timeout: 252 seconds]
plantman has quit [Ping timeout: 248 seconds]
shiru has joined #ruby
razetime has quit [Remote host closed the connection]
TomyWork has joined #ruby
Linux_Kerio has joined #ruby
Guest61 has joined #ruby
Guest61 has quit [Client Quit]
stirl has joined #ruby
Laplace has joined #ruby
tuxcrafter has quit [Quit: Client closed]
tuxcrafter has joined #ruby
tuxcrafter has quit [Client Quit]
tuxcrafter has joined #ruby
shiru has quit [Remote host closed the connection]
dionysus69 has quit [Ping timeout: 256 seconds]
<adam12>
Apparently rubygems.org repo for gem sources is 5.2TB compressed. :O
<leah2>
and 4.2TB of that is libxml binaries?
<adam12>
leah2: LOL. I'm not sure, tho I am intrigued. I only have 2 nokogiri releases archived, and they are ~ 6 MB each.
<leah2>
imagine how may loc ruby are 6mb
<adam12>
Contrary that to the other gems I talked about yesterday, which are about 45-50 MB each (3 of them alone make up 15 GB of my archive)
<adam12>
I was thinking about offering some sort of mirror, where you could ssh in and grep through every gem released, but I'd have to re-architect if I was going to store 5.2+ TB.
<adam12>
Or just say nope to anybody with 50MB daily releases.
<leah2>
how is it compressed?
<leah2>
gems are zip no?
<adam12>
Not zip, afaik.
<adam12>
I actually don't remember now, tho I looked just a few months ago. It's a package of packages.
<leah2>
or tar
<adam12>
I think it's a tgz of tz.
<adam12>
err, tar of tgz.
<leah2>
ok
<adam12>
or a tgz of tars. Oneo f those.
<leah2>
so it compresses across files hmm
<adam12>
I use transparent compression on the filesystem.
<adam12>
Or at least, that's what I currentlt do for gemdocs.org.
<leah2>
zfs?
<adam12>
Yep.
<adam12>
Well, btrfs and zfs.
<adam12>
btrfs is legacy, and what I started with. But I am gradually moving to zfs.
<leah2>
i wonder if zfs dedup would work
rapha has joined #ruby
<rapha>
hi all!
<leah2>
or use ginormeous amounts of ram
<leah2>
hi rapha
<adam12>
rapha: hello
<adam12>
leah2: dedup might work. at least with yard doc output, there's a lot of common assets that I store repeatedly.
<adam12>
leah2: I've never had good dedup experience tho.
<adam12>
Rather just throw more TB at the machine.
<rapha>
when `bundle env` and `gem env` agree on /home/jrs/.gem/ruby/3.0.0 being in the Gem Path, shouldn't running, say, `rake -T` (instead of `bundle exec rake -T`) also be working? The Gems are all installed in that path, but the former command complains it can't load the gems. I'm confused by this.
<rapha>
Hey leah2 and adam12 :)
<rapha>
Did you both have a happy new year's eve?
<adam12>
rapha: when you call `rake`, do you get the one from that path?
<adam12>
Technically the `rake` from that path isn't likely to be setting up bundler env, so I am not sure it would work without complaints.
<rapha>
aha! ofc, that's it! in that case i get /usr/bin/rake
<rapha>
ok, then it's logical one needs to prefix with `bundle exec`. thanks!
<adam12>
leah2: I'm actually trying to wrap up migration off btrfs this week. I'm exporting the btrfs image over ssh+nbd and it's working but it's not without it's issues.
<adam12>
rapha: I'd generate binstub. Then you can push bin/ with direnv if desired.
<adam12>
rapha: bundle binstubs rake
<rapha>
i didn't understand well, adam. `which rake` is still the same after `bundle binstubs rake`.
<adam12>
I wanted to mirror all ruby source because if I updated yard/rdoc/whatever, I'd like to regenerate all source with new version. And I dont want to redownload all that every time from rubygems.org.
<adam12>
rapha: That command makes a bin/rake file
<adam12>
rapha: So now instead of bundle exec rake, you bin/rake
<rapha>
oooh, right in .
<adam12>
rapha: Or, install direnv, and PATH_add bin/. Then you can just `rake`.
<rapha>
not sure if i want a bin/ folder in every repo...
<rapha>
i'm fine with `bundle exec ...`. was just confused the general behaviour, but the confusion is now cleared up.
<adam12>
rapha: Maybe just alias be='bundle exec'
<adam12>
rapha: Yeah.
* rapha
might be lazy but not when it comes to typing ... didn't get those Keychron K80 for no reason :P
henk has left #ruby [#ruby]
travelingwilbur has joined #ruby
c10l has quit [Ping timeout: 260 seconds]
plantman2 has joined #ruby
plantman has joined #ruby
c10l has joined #ruby
Sheilong has joined #ruby
plantman has quit [Ping timeout: 260 seconds]
plantman2 has quit [Ping timeout: 260 seconds]
caedmon has joined #ruby
c10l has quit [Ping timeout: 272 seconds]
caedmon has quit [Ping timeout: 268 seconds]
stirl has quit [Ping timeout: 260 seconds]
leonthemisfit has quit [Quit: WeeChat 3.6]
Sankalp has quit [Ping timeout: 260 seconds]
___nick___ has joined #ruby
stirl has joined #ruby
crax23 has quit [Ping timeout: 256 seconds]
tuxcrafter has quit [Quit: Client closed]
tuxcrafter has joined #ruby
___nick___ has quit [Ping timeout: 268 seconds]
Sankalp has joined #ruby
___nick___ has joined #ruby
TomyWork has quit [Remote host closed the connection]
grawity has quit [Remote host closed the connection]