havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
kristian_on_linu has quit [Remote host closed the connection]
TCZ has joined #ruby
roadie has joined #ruby
<leitz> sagax, doesn't an "if" or "unless" cover that?
<leitz> I'm for fewer keywords, myself. Not too few, though. This isn't Go.
olddogbarks has quit [Ping timeout: 252 seconds]
<sagax> i can `value == nil` or `value == true` or `value == false` but i looking for better way. we have `value.nil?` and maybe we have some like as `true?` or `false?`
roadie has quit [Ping timeout: 260 seconds]
dandaman has joined #ruby
olddogbarks has joined #ruby
<dandaman> what's the difference between these two syntaxes? my_object['some_key'] vs my_object[:some_key]
<sagax> 'some_key' it's string, :some_key it's symbol
<sagax> f = {:a => 1, 'a' => 2} --> f[:a] --> 1 and f['a'] --> 2
<sagax> it's not just syntax
<dandaman> what's the difference between making the key a symbol vs a string?
<havenwood> dandaman: A String is regular text data. A Symbol is a label with a text name.
<sagax> not different, for key you can use something like as f = {:a => 1, 'a' => 2, 3 => 4}
<sagax> string, symbol, number
<havenwood> dandaman: Symbols tend to make great Hash keys, so they got syntactic sugar so `{aim: true}` is the same as `{:aim => true`}, like sagax said.
<dandaman> got it, so is there any reason to use one over the other?
<dandaman> havenwood: why do they make great hash keys
<dandaman> ?
<havenwood> dandaman: They are frozen by default, so no mutation possibility and they have a handy syntax with Hashes.
<havenwood> dandaman: You'll know when you need a String, typically.
<dandaman> wouldnt a string be frozen by default too? like you can't really change the key in an objectm right? can you give me an example of when i'd want a string vs a symbol as the key?
<dandaman> "like you can't really change the key in an objectm right?" by that i mean, if you change the key you're basically just moving the value to a different "place"
<xco> anyone got an idea why my post_install message comes between install? and not AFTER everything else is installed? https://gist.github.com/xcobar/7fe51f4cd31bdb48e0cf77c2e58a00cf here's my gemspec https://github.com/siaw23/kovid/blob/master/kovid.gemspec
greypack has quit [Ping timeout: 240 seconds]
greypack has joined #ruby
zacts has joined #ruby
sergioro has quit [Quit: leaving]
wildtrees has quit [Quit: Leaving]
roadie has joined #ruby
TCZ has quit [Quit: Leaving]
leitz has quit [Quit: Leaving]
roadie has quit [Ping timeout: 256 seconds]
<adam12> xco: I don't have a 100% correct answer for you other than maybe bundler captures the messages and displays them at the end, and that's what you're used to.
<xco> adam12 i'd expect for bundler to display the post-install msg last ideally... it's not doing that for some reason.
<adam12> xco: The example you shared shows you installing with `gem`, not `bundle`
<xco> adam12 right... so i've i'm using `gem` is there a way to make the install msg come last?
<adam12> xco: I don't think so.
<xco> hmmm insteresting
<xco> thank you :)
<adam12> Confirming that bundler indeed collects post_install_messages then renders them last, all at once. https://github.com/rubygems/rubygems/blob/a753447de8fb92dad30e927656984aa2b7765f3d/bundler/lib/bundler/cli/install.rb#L79
<xco> that's helpful, i think the behaviour i'm after should be hackable... i'll keep playing with it until something comes up
<adam12> xco: Not sure how your tool is used but if it's a binary/script maybe you could have a message that is displayed on first run.
<xco> adam12 it's just a CLI, you type commands to it for an output
<xco> everything happens in the shell
caterfxo has quit [Ping timeout: 264 seconds]
<adam12> xco: Maybe try the message bit. Just track that you've displayed it to the user somehow (writing to the XDG config directory for your script or something).
<adam12> xco: Or put it in the help message for your script. Or have an `--about` flag or something.
<xco> adam12 that'll be a good idea too
roadie has joined #ruby
sergioro has joined #ruby
jidar has quit [Quit: WeeChat 2.8]
roadie has quit [Ping timeout: 258 seconds]
jinmiaoluo has joined #ruby
jidar_ has joined #ruby
jidar_ has quit [Client Quit]
jidar has joined #ruby
jidar has quit [Client Quit]
jidar has joined #ruby
duderonomy has joined #ruby
<havenwood> dandaman: When a String is used as a key, Ruby duplicates, then freezes it, leaving the original untouched. This works, but creates a duplicates object with the corresponding memory usage and pressure on the GC.
<havenwood> dandaman: A Symbol is mean to be a label, which is exactly what a key is, so they align nicely.
<havenwood> dandaman: A Symbol key doesn't need to be duplicated or frozen, and can just be used directly without fuss.
<dandaman> ahhh i see
<havenwood> dandaman: As the Hash docs mention, "a String passed as a key will be duplicated and frozen."
<dandaman> so when would it ever make sense to use a string as a key?
<dandaman> why not just build the language in a way where all keys are interpretted as symbols, even if you pass in a string
<havenwood> dandaman: Ruby allows many ways to do a thing, but tries to make the right way the most beautiful. Here, the syntactic sugar with Symbols guides you to the best key form for a text label.
<havenwood> {aim: true}
<havenwood> is prettier than
alfiemax has joined #ruby
<havenwood> {"aim" => true}
<havenwood> You can see through it without inclusions.
<dandaman> can't deny the asthetics of the former… just wondering if there's any usecase for the latter
<havenwood> dandaman: There aren't a ton of usecases. It's more common to see an Integer key.
<havenwood> dandaman: Symbols are basically Integers with a text label.
roadie has joined #ruby
<dandaman> hmm, alright. thanks for taking the time to explain it all to me. The fact that it's possible to use strings still bothers me a little bit but at least i now the proper way of doing things!
<dandaman> now know*
<havenwood> dandaman: It used to be that Symbols were never garbage collected and Strings were usually mutable. These days they've converged somewhat since Symbols *are* GCed and Strings literals can be frozen by default with a magic comment.
<havenwood> dandaman: No prob, any time.
alfiemax has quit [Ping timeout: 256 seconds]
dandaman has quit [Quit: Leaving.]
roadie has quit [Ping timeout: 240 seconds]
ChmEarl has quit [Quit: Leaving]
Esa__ has quit []
jinmiaoluo has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
jinmiaoluo has joined #ruby
roadie has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
chalkmonster has joined #ruby
gix has quit [Disconnected by services]
dandaman has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
jinmiaoluo has quit [Ping timeout: 256 seconds]
troulouliou_div2 has quit [Ping timeout: 256 seconds]
jinmiaoluo has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
troulouliou_div2 has joined #ruby
troulouliou_dev has joined #ruby
chalkmonster has joined #ruby
jinmiaoluo has quit [Quit: WeeChat 2.8]
chalkmonster has quit [Client Quit]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Ping timeout: 256 seconds]
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
roadie has joined #ruby
chalkmonster has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
dandaman has quit [Quit: Leaving.]
chalkmonster has quit [Quit: WeeChat 2.8]
greypack has quit [Ping timeout: 256 seconds]
greypack has joined #ruby
roadie has joined #ruby
elcontrastador has joined #ruby
polishdub has joined #ruby
alexherbo2 has joined #ruby
elcontrastador has quit [Quit: Textual IRC Client: www.textualapp.com]
chalkmonster has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
polishdub has quit [Quit: leaving]
_whitelogger has joined #ruby
evdubs has quit [*.net *.split]
darthThorik has quit [*.net *.split]
linuus[m] has quit [*.net *.split]
null__ has quit [*.net *.split]
Fusl has quit [*.net *.split]
nfsnobody has quit [*.net *.split]
Iambchop has quit [*.net *.split]
darthThorik has joined #ruby
null__ has joined #ruby
Fusl has joined #ruby
linuus[m] has joined #ruby
evdubs has joined #ruby
Iambchop has joined #ruby
nfsnobody has joined #ruby
alfiemax has joined #ruby
chalkmonster has joined #ruby
olddogbarks has quit [Quit: ZZZzzz…]
alfiemax has quit [Ping timeout: 240 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
tpanarch1st has quit [Ping timeout: 250 seconds]
chalkmonster has joined #ruby
postmodern has quit [Quit: Leaving]
sergioro has quit [Quit: leaving]
buckworst has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
kristian_on_linu has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ellcs has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
ldepandis has joined #ruby
sh7d_ has joined #ruby
sh7d_ has quit [Remote host closed the connection]
sh7d_ has joined #ruby
sh7d has quit [Ping timeout: 256 seconds]
olddogbarks has joined #ruby
plutes has quit [Ping timeout: 250 seconds]
sh7d_ has quit [Read error: Connection reset by peer]
sh7d has joined #ruby
xco has joined #ruby
felix_221986 has joined #ruby
felix_221986 is now known as feland250
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
markopasha has joined #ruby
markopasha has quit [Max SendQ exceeded]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
buckworst has quit [Quit: WeeChat 2.8]
feland250 has quit [Quit: Ping timeout (120 seconds)]
felix_221986 has joined #ruby
jinmiaoluo has joined #ruby
roadie has joined #ruby
buckworst has joined #ruby
imode has quit [Ping timeout: 260 seconds]
conta has joined #ruby
conta has quit [Ping timeout: 260 seconds]
conta has joined #ruby
alexherbo24 has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo24 is now known as alexherbo2
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #ruby
giorgian has quit [Quit: restart emacs]
alexherbo24 has joined #ruby
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo24 is now known as alexherbo2
giorgian has joined #ruby
giorgian has quit [Client Quit]
felix_221986 has quit [Quit: Connection closed]
alfiemax has joined #ruby
soniya29 has left #ruby ["Leaving"]
Ai9zO5AP has quit [Ping timeout: 240 seconds]
alfiemax has quit [Remote host closed the connection]
cliluw has quit [Ping timeout: 260 seconds]
cliluw has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
TCZ has joined #ruby
giorgian has joined #ruby
conta has quit [Ping timeout: 264 seconds]
<siery> Hey, is there a simple way to check if an instance variable is defined by given string?
<al2o3-cr> siery: Module#instance_variable_defined?
<al2o3-cr> &ri Module#instance_variable_defined? siery
<rubydoc> siery: Found no entry that matches class Module instance method instance_variable_defined?
<al2o3-cr> &ri Kernel#instance_variable_defined? siery
<rubydoc> siery: Found no entry that matches class Kernel instance method instance_variable_defined?
<al2o3-cr> &ri Object#instance_variable_defined? siery
<al2o3-cr> there we go.
<siery> al2o3-cr: Ya, thank you, that's what I been looking for
<al2o3-cr> siery: np ;)
<jhass> heh that bot shouldn't use the target for the error message :D
<jhass> phaul: ^ (iirc)
<phaul> jhass: yeah it's a bit clunky, hard to use because you need to get the receiver right. I was thinking how to make it better but couldn't come up with a better solution. We could supress the error message to make it less noisy.
<phaul> Or in case mulitple receivers respond to a method we could just chose the first
<jhass> I meant if I do &ri something phaul it should say jhass: not found and not phaul: not found :)
<phaul> ah, fair point
<phaul> I'll fix that
<jhass> <3
conta has joined #ruby
conta has quit [Client Quit]
TCZ has quit [Quit: Leaving]
licksjp has joined #ruby
<licksjp> Hello
<al2o3-cr> o/
<licksjp> I am japanese
<licksjp> I live in Japan
<al2o3-cr> very nice ;)
<licksjp> I have made the "姓名判断" program by ruby
<licksjp> my PC is Mac
<licksjp> my Ruby editor is Visual studio code
<pwnd_nsfw> interesting mix lol
<CommunistWolf> gedit is where it's at
<al2o3-cr> nano for it's simplicity.
<pwnd_nsfw> Notepad in a vm
<CommunistWolf> acceptable, but I quite like mouse support
<al2o3-cr> fair play.
<al2o3-cr> CommunistWolf: alt + m enables mouse support in nano
<CommunistWolf> oooh, magic
<al2o3-cr> TIL
xco has joined #ruby
<pwnd_nsfw> rifk
caterfxo has joined #ruby
Ai9zO5AP has joined #ruby
jinmiaoluo has quit [Remote host closed the connection]
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
jinmiaoluo has joined #ruby
<phaul> &ri invalid, jhass
<rubydoc> phaul: Found no entry that matches method invalid
<jhass> great :)
Ai9zO5AP has quit [Ping timeout: 240 seconds]
jinmiaoluo has quit [Ping timeout: 240 seconds]
buckworst has quit [Quit: WeeChat 2.8]
jinmiaoluo has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
Tempesta has quit [Quit: AdiIRC is updating to v3.9 Beta Build (2020/04/17 UTC) 64 Bit]
Tempesta has joined #ruby
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
Ai9zO5AP has joined #ruby
dandaman has joined #ruby
tpanarch1st has joined #ruby
dandaman has quit [Quit: Leaving.]
s2013 has joined #ruby
TCZ has joined #ruby
jinmiaoluo has quit [Remote host closed the connection]
jinmiaoluo has joined #ruby
factormystic has joined #ruby
jinmiaoluo has quit [Remote host closed the connection]
jinmiaoluo has joined #ruby
TCZ has quit [Quit: Leaving]
dandaman has joined #ruby
TomyWork has joined #ruby
dandaman has quit [Ping timeout: 256 seconds]
jinmiaoluo has quit [Ping timeout: 256 seconds]
sergioro has joined #ruby
seydar has joined #ruby
seydar has quit [Client Quit]
ChmEarl has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
Wolland has joined #ruby
rubydoc has quit [Ping timeout: 256 seconds]
rubydoc has joined #ruby
Wolland has quit [Quit: Mutter: www.mutterirc.com]
darkstardevx has joined #ruby
dandaman has joined #ruby
dandaman has quit [Ping timeout: 240 seconds]
imode has joined #ruby
giorgian has quit [Quit: restart emacs]
giorgian has joined #ruby
felix_221986 has joined #ruby
troulouliou_div2 has quit [Quit: Leaving]
tdy has quit [Ping timeout: 260 seconds]
sepp2k has joined #ruby
dandaman has joined #ruby
eyeris has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinmiaoluo has joined #ruby
eyeris has quit [Client Quit]
rippa has joined #ruby
jinmiaoluo has quit [Ping timeout: 256 seconds]
jinie has joined #ruby
jinie has quit [Remote host closed the connection]
jinmiaoluo has joined #ruby
jinie has joined #ruby
plutes has joined #ruby
plutes has quit [Remote host closed the connection]
plutes has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
MrCrackPot has joined #ruby
jinmiaoluo has quit [Ping timeout: 240 seconds]
MrCrackPot has quit [Client Quit]
olddogbarks has quit [Quit: ZZZzzz…]
jinmiaoluo has joined #ruby
troulouliou_div2 has joined #ruby
troulouliou_div2 has quit [Max SendQ exceeded]
troulouliou_div2 has joined #ruby
olddogbarks has joined #ruby
dinfuehr has quit [Ping timeout: 260 seconds]
dinfuehr has joined #ruby
jinmiaoluo has quit [Ping timeout: 256 seconds]
jinmiaoluo has joined #ruby
olddogbarks has quit [Quit: ZZZzzz…]
olddogbarks has joined #ruby
alfiemax has joined #ruby
vondruch has quit [Ping timeout: 264 seconds]
jinmiaoluo has quit [Ping timeout: 240 seconds]
jinmiaoluo has joined #ruby
dandaman has quit [Quit: Leaving.]
felix_221986 has quit [Quit: Connection closed]
hiroaki has quit [Ping timeout: 265 seconds]
hiroaki has joined #ruby
schne1der has joined #ruby
hiroaki has quit [Ping timeout: 258 seconds]
banisterfiend has joined #ruby
alfiemax has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
olddogbarks has quit [Ping timeout: 272 seconds]
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
conta has quit [Quit: conta]
TCZ has joined #ruby
SeepingN has joined #ruby
TomyWork has quit [Remote host closed the connection]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
dinfuehr has quit [Ping timeout: 264 seconds]
dinfuehr has joined #ruby
troulouliou_div2 has quit [Ping timeout: 264 seconds]
ellcs has quit [Ping timeout: 240 seconds]
s2013 has joined #ruby
ur5us has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
TCZ has quit [Quit: Leaving]
jinmiaoluo has quit [Ping timeout: 256 seconds]
jinmiaoluo has joined #ruby
mn3m has joined #ruby
duderono_ has joined #ruby
duderonomy has quit [Ping timeout: 265 seconds]
troulouliou_div2 has joined #ruby
troulouliou_dev has joined #ruby
leah2 has quit [Ping timeout: 272 seconds]
TCZ has joined #ruby
troulouliou_dev has quit [Max SendQ exceeded]
troulouliou_dev has joined #ruby
madduck has quit [Remote host closed the connection]
troulouliou_dev has quit [Max SendQ exceeded]
troulouliou_dev has joined #ruby
leah2 has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dandaman has joined #ruby
iNs has quit [Ping timeout: 240 seconds]
iNs_ has joined #ruby
s2013 has joined #ruby
greypack has quit [Ping timeout: 256 seconds]
G_ has joined #ruby
greypack has joined #ruby
G_ is now known as G
ldepandis has quit [Read error: Connection reset by peer]
darkstardevx has quit [Ping timeout: 258 seconds]
SeepingN has joined #ruby
darkstardev13 has joined #ruby
banisterfiend_ has joined #ruby
banisterfiend has quit [Ping timeout: 256 seconds]
banisterfiend_ is now known as banisterfiend
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banisterfiend has quit [Ping timeout: 258 seconds]
dviola has quit [Ping timeout: 260 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
TCZ has quit [Quit: Leaving]
licksjp has quit []
dviola has joined #ruby
s2013 has joined #ruby
zacts has quit [Quit: WeeChat 2.7.1]
troulouliou_dev has quit [Quit: Leaving]
imode has quit [Ping timeout: 250 seconds]
TCZ has joined #ruby
jetchisel has quit [Ping timeout: 265 seconds]