havenwood changed the topic of #ruby to: Ruby 3.3.6 (3.4.0-preview2) https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
<vvn> is there a smarter way to do: foo = hash['foo']; hash['foo'] = Base64.decode64(foo) if foo
graaff has quit [Ping timeout: 244 seconds]
<vvn> hash['foo'] = Base64.decode64(hash['foo']) maybe?
<vvn> ||=*
<vvn> oops no I don't want to set it if nil
<vvn> hash['foo'] = Base64.decode64(hash['foo']) if hash.has_key? 'foo'
graaff has joined #ruby
ox has joined #ruby
oz has quit [Ping timeout: 255 seconds]
cappy has quit [Quit: Leaving]
<adam12> vvn: Is there more to this? Maybe we can offer a better solution knowing more of the problem (ie. transform_values)
<vvn> no that's it, an optional key which value is base64 encoded (and I want to decode it if it is present)
<adam12> You want to decode if if it's present and then re-assign it to the same value? So it's no longer encoded?
<adam12> Sounds like transform values to me? hash.transform_values { Base64.decode64(_1) }
<vvn> can it be conditional? There's only one value which is encoded
<vvn> oh I don't know the _1 notation
__DuBPiRaTe__ has joined #ruby
Sampersand has joined #ruby
hwpplayer1 has joined #ruby
konsolebox has joined #ruby
Sampersand has quit [Ping timeout: 256 seconds]
eddof13 has quit [Quit: eddof13]
hwpplayer1 has quit [Quit: I'll be back later]
__DuBPiRaTe__ has quit [Quit: Leaving]
hwpplayer1 has joined #ruby
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 255 seconds]
<lunarkitty> If you want to avoid variables you can do something like hash['foo'] and hash['foo'] = Base64.decode64(hash['foo'])
<lunarkitty> (note I'm a fan of `and` over `&&` for *control flow*, some people don't like that, but that's what it's apparently for)
fercell has joined #ruby
<lunarkitty> if you wanna get really fancy you could use refinements and add a new hash method to do that. But that's way overkill for a single field
cappy has joined #ruby
Sampersand has joined #ruby
hwpplayer1 has quit [Quit: I'll be back later]
<vvn> I agree for the 'and'
<vvn> and/or are a bit confused, surprised they didn't get deprecated over time
<o0x1eef> I often think one-liners like that are best solved with a bit more context about the code - there might be another way to express it
<Sampersand> i love and/or
brokkoli_origin has quit [Ping timeout: 252 seconds]
brokkoli_origin has joined #ruby
<Sampersand> Your `hash['foo'] = Base64.decode64(hash['foo']) if hash.has_key? 'foo` is the best way to do it imo vvn
<lunarkitty> Yeah
<lunarkitty> The only reason to do it differently is imo if you needed to to a lot of keys
<lunarkitty> to do*
<o0x1eef> This could also work: h["foo"] = h["foo"]&.unpack1("m")
<lunarkitty> that's pretty fancy
<lunarkitty> sometimes I just monkey patch in a String#from_b64 and #to_b64 :p
<o0x1eef> Sounds nice
<lunarkitty> really overkill way if you wanted to do this over and over again without writing the same thing, obviously impractical for this but it was fun lol https://www.jdoodle.com/ia/1sYO
<lunarkitty> also found a cool replit alternative, apparently they're not free anymore hmm
hwpplayer1 has joined #ruby
lunarkitty has quit [Remote host closed the connection]
<Sampersand> o0x1eef woudlnt that set `h["foo"]` if it was unset
c10l has quit [Ping timeout: 244 seconds]
<o0x1eef> Yep - it would assign nil and a key. But IME that rarely matters.
c10l has joined #ruby
lunarkitty has joined #ruby
ih8u2 has joined #ruby
ih8u has quit [Ping timeout: 248 seconds]
ih8u2 is now known as ih8u
Sampersand has quit [Quit: Client closed]
ih8u2 has joined #ruby
ih8u has quit [Ping timeout: 252 seconds]
ih8u2 is now known as ih8u
mange has joined #ruby
mange has quit [Client Quit]
Munto has quit [Quit: Leaving]
hwpplayer1 has quit [Quit: I'll be back]
dhruvasagar has joined #ruby
dhruvasagar has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
Linux_Kerio has joined #ruby
grenierm has joined #ruby
mweckbecker has quit [Ping timeout: 252 seconds]
waesum has quit [Ping timeout: 252 seconds]
waesum has joined #ruby
mweckbecker has joined #ruby
cappy has quit [Quit: Leaving]
dhruvasagar has quit [Ping timeout: 248 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 244 seconds]
konsolebox has quit [Ping timeout: 260 seconds]
grenierm has quit [Quit: Client closed]
konsolebox has joined #ruby
grenierm has joined #ruby
Linux_Kerio has quit [Ping timeout: 248 seconds]
grenierm has quit [Ping timeout: 256 seconds]
niv has quit [Quit: ZNC - https://znc.in]
niv has joined #ruby
TomyWork has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
hightower3 has quit [Remote host closed the connection]
sekmo has joined #ruby
sekmo has quit [Quit: Client closed]
weaksauce has joined #ruby
weaksauc_ has quit [Ping timeout: 248 seconds]
<ih8u> any mdns/bonjour/zeroconf options for ruby?
donofrio has joined #ruby
hwpplayer1 has joined #ruby
tuxcrafter has joined #ruby
fercell has quit [Quit: ZNC - https://znc.in]
fercell has joined #ruby
user71 has joined #ruby
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
Linux_Kerio has joined #ruby
eddof13 has joined #ruby
snonux has quit [Quit: ZNC 1.9.1 - https://znc.in]
snonux has joined #ruby
naiithink has joined #ruby
naiithink has quit [Quit: leaving]
c10l has quit [Quit: Ping timeout (120 seconds)]
c10l has joined #ruby
c10l has quit [Ping timeout: 276 seconds]
c10l has joined #ruby
desnudopenguino has quit [Read error: Connection reset by peer]
desnudopenguino has joined #ruby
hwpplayer1 has quit [Quit: I'll be back later]
mattf has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
mattf has joined #ruby
<havenwood> ih8u: Apparently works on my machine. What seems to be the problem?
<havenwood> Oh, I see you're the one issue. Gotcha. https://github.com/tenderlove/zeroconf/issues/4
kludger has joined #ruby
<havenwood> FWIW, returns an Array on Debian trixie.
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
cappy has joined #ruby
TomyWork has quit [Remote host closed the connection]
carpincho has joined #ruby
ftajhii has quit [Read error: Connection reset by peer]
ftajhii has joined #ruby
carpincho has quit [Changing host]
carpincho has joined #ruby
tuxcrafter has quit [Quit: Client closed]
tuxcrafter has joined #ruby
gr33n7007h has quit [Quit: WeeChat 4.4.3]
gr33n7007h has joined #ruby
ox is now known as oz
Sampersand has joined #ruby
<brokkoli_origin> I don't understand. After i install iruby with 'gem install iruby' it was ok. But 'iruby register --force' doesn't work (not found). But iruby is in gem list. 'gem which iruby' -> ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/iruby-0.8.0/lib/iruby.rb . 'gem install iruby' is a bad method or what is the situation? any idea?
<J_B> !help
<ruby[bot]> J_B: You can find a list of my commands on http://ruby-community.com/ruboto/commands and my factoids on http://ruby-community.com/ruboto/facts
<brokkoli_origin> I like to use it in Jupyter, and i have read this method is the right method for install
<cappy> Those ruby bot pages seem "privileged". How to get in?
donofrio has quit [Ping timeout: 276 seconds]
Vonter has quit [Ping timeout: 252 seconds]
Vonter has joined #ruby
kludger_ has joined #ruby
kludger has quit [Ping timeout: 260 seconds]
kludger has joined #ruby
kludger_ has quit [Ping timeout: 260 seconds]
Lestat9 has joined #ruby
<Lestat9> Near Death Experiencer(Ghost People) Chat Site- Secure. http://hant.us.to
Lestat9 has quit [K-Lined]
konsolebox has quit [Quit: .]
<brokkoli_origin> ok, i started iruby under jupyter. it doesn't work well yet, but works ..
kludger has quit [Ping timeout: 248 seconds]
Sampersand has quit [Ping timeout: 256 seconds]
_whitelogger_ has joined #ruby
brokkoli_origin has quit [Ping timeout: 248 seconds]
brokkoli_origin has joined #ruby
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #ruby
carpincho has quit [Ping timeout: 252 seconds]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
mange has joined #ruby
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #ruby
Sampersand has joined #ruby
user71 has quit [Quit: Leaving]
_whitelogger_ has quit [Remote host closed the connection]
hwpplayer1 has joined #ruby
gorignak has quit [Quit: quit]
__DuBPiRaTe__ has joined #ruby
Sampersand has quit [Quit: Client closed]
in_sis_panties has joined #ruby
in_sis_panties has quit [Client Quit]
__DuBPiRaTe__ has quit [Remote host closed the connection]
__DuBPiRaTe__ has joined #ruby
CRISPR has joined #ruby
hwpplayer1 has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 260 seconds]
CRISPR has quit [Ping timeout: 246 seconds]
rvalue- is now known as rvalue
_whitelogger_ has joined #ruby
Linux_Kerio has quit [Ping timeout: 272 seconds]
tuxcrafter has quit [Quit: Client closed]
tuxcrafter has joined #ruby