adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
bandithijo has joined #ruby
bandithijo has quit [Quit: WeeChat 3.2-rc1]
jetchisel has joined #ruby
menace has joined #ruby
graywolf has joined #ruby
jetchisel has quit [Ping timeout: 258 seconds]
jetchisel has joined #ruby
niv has quit [Quit: Powered by LunarBNC: https://LunarBNC.net]
niv has joined #ruby
swaggboi has joined #ruby
michigan has joined #ruby
StayHungry has joined #ruby
<StayHungry> Good morning, comrades
<StayHungry> I'm exploring syntax and possibilities of various scripting languages related to the following task:
<StayHungry> Swap 24-07-2021 into 2021-07-24
<StayHungry> Ruby is the last one on my list after Lua, Perl, Python, Powershell, NodeJS, and AWK
<StayHungry> I wonder how would you do that in the shortest possible way, basically a one-liner to execute from command line
graywolf has quit [Quit: WeeChat 3.2]
<weaksauce> could just do a basic split on -
<weaksauce> then swap it
<weaksauce> assuming the data is normalized
<StayHungry> yep, seems only 2 ways exist to approach this
<StayHungry> either split,reverse,join
<StayHungry> or capture groups then reorder
<weaksauce> yeah
<StayHungry> except for limited lua, which helped with capture groups, rest of mentioned languages did it the first way
<StayHungry> so i wonder the syntax of ruby here
<nakilon> .split("-").reverse.join("-")
<nakilon> you basically translate the task from English to Ruby word by word
<weaksauce> > "07-2-2021" =~ /([0-9]{2})/; $1
<weaksauce> but i'd do the more descriptive way
<StayHungry> by the way, if you're interested how other languages syntax looks here: https://dpaste.org/MgxA/slim
<nakilon> .scan(/\d+/).reverse.join("-")
<nakilon> I code in Ruby exactly because I know how other languages look
<StayHungry> hmm, your code looks almost exactly as javascript's for nodejs :D
<nakilon> because javascript likes ruby -- see coffe script
<weaksauce> wasn't always that way
<StayHungry> ruby.exe -e "print(('24-07-2021').split('-').reverse.join('-'))" is the shortes way here, right?
<weaksauce> god why would someone want to program in python like that
<nakilon> you can use ?- instead of "-"
<weaksauce> oof
<weaksauce> sub puts for print
<weaksauce> gets you a lil shorter
<StayHungry> weaksauce: you mean nested way instead of sequential? i'm shocked too :)
<weaksauce> yeah "-".join is where you lost me
<StayHungry> +1
<weaksauce> obfuscates the intent like mad
<nakilon> [you in Python.to(supposed.(like(that)).write())]
<StayHungry> :D
<weaksauce> haha
<nakilon> damn I even lost "are" somewhere
<weaksauce> it blows my mind that the zeitgeist went the python way
<weaksauce> packaging sucks hard
<weaksauce> the indentation thing is worse in all regards
<StayHungry> shortest was powershell's, most elegant seems to be awk, most clear is either js and ruby, rest are so-so
<michigan> ruuuuuuby!
<StayHungry> however, ruby.exe takes 350ms to launch :( maybe there is a way to accelerate it?
<michigan> is so frekin gorgeous like a modernized and simplfied alternative to python
<weaksauce> cruby probably StayHungry
<weaksauce> i mean i just did a small ruby oneliner and it was no time at all really
<nakilon> also there is some flag to "not load bundled gems", see --help
<weaksauce> but if you want initial startup time to be real low don't use ruby
<weaksauce> probably python too
<weaksauce> and if you are calling a ruby script often it's probably at the wrong level of abstraction
<nakilon> what is Zeitgeist ? wikipedia says it's now in Vala, not Pithon
<StayHungry> ruby --disable=gems -e "puts(('24-07-2021').split('-').reverse.join('-'))" -> 50 ms, hooray
<StayHungry> cruby is something not bundled here, it's kind of abandonware right now, or not?
<StayHungry> no, perhaps you meant chruby which seems not to be available for Windows
<StayHungry> nonetheless, thank you for warm welcome and help in-depth, comrades
StayHungry has quit [Quit: -]
aighearach_ has quit [Changing host]
aighearach_ has joined #ruby
aighearach_ is now known as aighearach
reset has quit [Quit: reset]
swaggboi has quit [Quit: C-x C-c]
Guest8 has joined #ruby
Guest8 has quit [Client Quit]
swaggboi has joined #ruby
niv has quit [Quit: Powered by LunarBNC: https://LunarBNC.net]
niv has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
Rounin has quit [Ping timeout: 240 seconds]
_axx6 is now known as _axx
ua_ has joined #ruby
jetchisel has joined #ruby
raw-bean has joined #ruby
_ht has joined #ruby
raw-bean has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
postmodern has joined #ruby
ollysmith has joined #ruby
ollysmith has quit [Client Quit]
ollysmith has joined #ruby
mbrndtgn has quit [Quit: The Lounge - https://thelounge.chat]
mbrndtgn has joined #ruby
crawler has quit [Quit: ZNC - https://znc.in]
Rounin has joined #ruby
reset has joined #ruby
postmodern has quit [Read error: Connection reset by peer]
MalkbabY has joined #ruby
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
MalkbabY has quit [Ping timeout: 240 seconds]
MalkbabY has joined #ruby
shokohsc has quit [Read error: Connection reset by peer]
shokohsc has joined #ruby
raw-bean has joined #ruby
raw-bean has quit [Client Quit]
raw-bean has joined #ruby
raw-bean has quit [Ping timeout: 252 seconds]
raw-bean has joined #ruby
raw-bean has quit [Ping timeout: 255 seconds]
easbarbosa has joined #ruby
easbarbosa has quit [Ping timeout: 276 seconds]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
AriT93 has joined #ruby
phenom has quit [Ping timeout: 255 seconds]
phenom has joined #ruby
Tempesta has quit [Quit: See ya!]
Tempesta has joined #ruby
AriT93 has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
AriT93 has joined #ruby
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
ur5us has joined #ruby
ur5us has quit [Quit: Leaving]
ur5us has joined #ruby
ur5us has quit [Ping timeout: 272 seconds]
mrkz_c has quit [Quit: Connection closed for inactivity]
_ht has quit [Remote host closed the connection]
michigan has quit [Quit: Connection closed for inactivity]
AriT93 has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
crankharder has joined #ruby
crankharder has quit [Client Quit]
willow has joined #ruby
michigan has joined #ruby
<willow> is a class-level method similar to a static method in java?
<willow> in other words one doesn't have to instantiate the class to access the method
<weaksauce> yeah basically
<willow> right on thanks
ua_ has quit [Ping timeout: 265 seconds]