havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 3.3.0-preview1: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
crespire1 has quit [Ping timeout: 240 seconds]
crespire has quit [Killed (NickServ (GHOST command used by crespire1!crespire@user/crespire))]
crespire1 has joined #ruby
Guest20 has joined #ruby
Guest20 has quit [Client Quit]
roshanavand has quit [Ping timeout: 256 seconds]
roadie has joined #ruby
kaivai has quit [Quit: ZNC - https://znc.in]
roadie has quit [Ping timeout: 248 seconds]
kaivai has joined #ruby
kaivai has quit [Client Quit]
kaivai has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
roadie has joined #ruby
Pixi` has joined #ruby
Pixi has quit [Ping timeout: 268 seconds]
roadie has quit [Ping timeout: 248 seconds]
<adam12> ruby -s -e 'p $abc' -- -abc=foo
<adam12> huh interesting.
<mooff> wild
<adam12> Kind of an interesting alternative to env variables, tho maybe using full on optionparser might be better.
<mooff> if you read the help for the ruby command it sounds like they wanted it to be like awk or sed
<adam12> Does -s come from awk/sed? I had to look at the tests for -s to figure out what the heck it does. The help doesn't really explain it.
<adam12> At least cursory.
<adam12> -s enable some switch parsing for switches after script name
<mooff> there are lots of little supporting flags like that. there's some constant that means "list of data from args or stdin"
<adam12> _some_ switch parsing?
<mooff> separate to ARGF and ARGV
<mooff> ARGF is already a big one
<mooff> lol yes, some
<adam12> I just wonder if it could be phrased better.
<mooff> i don't know about -s
<mooff> but there's -i:
<mooff> % ruby -p -i.bak -e '$_.upcase!' /tmp/junk
<mooff> (-i for "edit file in place". i guess -i.bak means that, and also make a .bak file first)
<adam12> Oh, yeah. Those aren't new to me.
<mooff> what is -p?
<adam12> Specifically, -s was.
<mooff> acts the same as -n.
<mooff> what on earth is -n?!
<mooff> this is the only reason i don't use these lol
<mooff> i can't remember it every time
<adam12> LOL. I use them, but I did Perl back in early 2000's so there is lots of carry over.
<mooff> yeah. i love the mix of paradigms in Ruby
<adam12> There was a talk from Hashicorp about testing, and one of the things they do is have a -golden flag to re-record things (I think I'm remembering correctly). But what was elegant about that was just at the top of the test file was flags.Flag("-golden", "Re-record") or something. One single line.
<mooff> did i say i've gone back to writing "for foo in bar" instead of foo.each do |bar| ?
<adam12> It was just beautiful. I think the -s can kind of get you similar, but it won't show up in help.
<adam12> Minitest hijacks optionparser anyways...
<mooff> adam12: that sounds like flag.Flag from Go
<mooff> which yes is lovely
<adam12> Really? I wouldn't do it. Enumerable is life.
<mooff> for x in is based on .each
<mooff> once i saw that i was hooked
<mooff> it even highlights better in the editor
<adam12> That might fly on my own projects, but on some teams I engage with, it's hard enough just teaching Enumerable.
<adam12> Which is unfortunate because the chaining of Enumerable is super elegant.
<mooff> in Go you don't have to think about flag parsing
<mooff> in Ruby or Python, there are literally 3 built in ways
<adam12> What are the other two?
<mooff> with similar but different arguments and method names
<mooff> maybe i'm 'hallucinating'. i thought optparse and OptionParser were two different libs
<mooff> with getoptlong to go with them
<adam12> Oh yes. I forgot about getoptlong. I don't recall seeing it in use in a very long time.
<mooff> yeah, i was wrong
<adam12> optparse and OptionParser is annoying.
<adam12> There needs to be an optionparser.rb shim that requires optparse.
<mooff> send a pr?
<adam12> Maybe. I wonder what the stance is on that.
<adam12> Ohh. Maybe one already exists.
<adam12> >> require "optionparser"
<mooff> imagine a tui that made Ruby consoles look like Smalltalk
<ruby[bot]> adam12: # => true (https://carc.in/#/r/f239)
<mooff> but for live introspection / repling of the system
<mooff> = require "optionparser"
<mooff> huh
ruby-eval has joined #ruby
<mooff> = %w(optparse optionparser).map { require _1 rescue :error }
<mooff> = %w(optparse optionparser).map { require _1 rescue :error }
<ruby-eval> => [true, true]
<mooff> cool.
crespire has joined #ruby
<adam12> May 2014 it was added. I guess my memory is fuzzy.
crespire1 has quit [Ping timeout: 268 seconds]
goldfish has quit [Remote host closed the connection]
roadie has joined #ruby
ghostl has joined #ruby
<mooff> what if classes could be included like modules can
<mooff> a class could be simply a module with an initialize method in
roadie has quit [Ping timeout: 248 seconds]
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
crespire1 has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
jhass has quit [Ping timeout: 246 seconds]
jhass has joined #ruby
desnudopenguino has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
Pixi` is now known as Pixi
grenierm has joined #ruby
immiss97 has joined #ruby
ghostl has quit [Ping timeout: 264 seconds]
immiss97 has quit [Ping timeout: 265 seconds]
roadie has joined #ruby
jhass has quit [Ping timeout: 240 seconds]
jhass has joined #ruby
rvalue has quit [Ping timeout: 265 seconds]
roadie has quit [Ping timeout: 248 seconds]
rvalue has joined #ruby
roadie has joined #ruby
ghostl has joined #ruby
grenierm has quit [Quit: Client closed]
crespire has joined #ruby
crespire1 has quit [Ping timeout: 240 seconds]
sagax has quit [Remote host closed the connection]
___nick___ has joined #ruby
_ht has joined #ruby
ghostl has quit [Ping timeout: 268 seconds]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
weaksauce has quit [Ping timeout: 256 seconds]
weaksauce has joined #ruby
infinityfye has joined #ruby
roshanavand has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
roshanavand has quit [Ping timeout: 268 seconds]
gr33n7007h has quit [Ping timeout: 256 seconds]
gr33n7007h has joined #ruby
ollysmith has quit [Quit: ZNC 1.8.2+deb3+b4 - https://znc.in]
ollysmith has joined #ruby
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
ollysmith has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
ollysmith has joined #ruby
gasbag has joined #ruby
gasbag has quit [Remote host closed the connection]
mark22k has left #ruby [#ruby]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 264 seconds]
Sankalp- is now known as Sankalp
infinity_fye has joined #ruby
infinityfye has quit [Ping timeout: 240 seconds]
ghostl has joined #ruby
ghostl has quit [Ping timeout: 240 seconds]
MalusVulgaris has joined #ruby
hwpplayer1 has joined #ruby
desnudopenguino has joined #ruby
jhass has quit [Quit: Bye]
jhass has joined #ruby
MalusVulgaris has quit [Remote host closed the connection]
goldfish has joined #ruby
hwpplayer1 has quit [Ping timeout: 240 seconds]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
hwpplayer1 has joined #ruby
Tempesta has quit [Quit: See ya!]
Tempesta has joined #ruby
infinityfye_ has joined #ruby
infinity_fye has quit [Ping timeout: 240 seconds]
goldfish has quit [Remote host closed the connection]
sam113102 has joined #ruby
sam113101 has quit [Ping timeout: 240 seconds]
sam113102 is now known as sam113101
johnjaye has quit [Quit: WeeChat 4.0.0-dev]
johnjaye has joined #ruby
___nick___ has quit [Ping timeout: 240 seconds]
sshock has joined #ruby
sshock has left #ruby [#ruby]
roshanavand has joined #ruby
infinityfye_ has quit [Quit: Leaving]
hwpplayer1 has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.2)]
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roshanavand has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
tomtmym has quit [Quit: Gone.]
c10l has quit [Quit: See ya! o/]
c10l has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 240 seconds]
desnudopenguino1 is now known as desnudopenguino
roadie has joined #ruby