havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.1, 3.1.3, 3.0.5, 2.7.7: 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/
prores18 has quit [Ping timeout: 268 seconds]
donofrio__ has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
donofrio__ has joined #ruby
beatif88 has joined #ruby
nirvdrum has joined #ruby
gcd has quit [Quit: leaving]
gcd has joined #ruby
dviola has quit [Ping timeout: 264 seconds]
dviola has joined #ruby
unsolu51 has joined #ruby
counte18 has joined #ruby
beatif88 has quit [Ping timeout: 248 seconds]
razetime has quit [Ping timeout: 252 seconds]
unsolu51 has quit [Ping timeout: 246 seconds]
razetime has joined #ruby
NonatoAguiar has quit [Quit: Client closed]
razetime has quit [Ping timeout: 252 seconds]
swaggboi has quit [Quit: C-x C-c]
swaggboi has joined #ruby
counte18 has quit [Ping timeout: 246 seconds]
stirl has joined #ruby
hightower4 has joined #ruby
hightower3 has quit [Ping timeout: 276 seconds]
razetime has joined #ruby
<tsujp> How is this ruby gem calling Polars? I don't understand: https://github.com/ankane/polars-ruby
helge has quit [Ping timeout: 255 seconds]
helge has joined #ruby
swaggboi has quit [Quit: C-x C-c]
moldorcoder7 has quit [Ping timeout: 268 seconds]
moldorcoder7 has joined #ruby
swaggboi has joined #ruby
razetime has quit [Ping timeout: 268 seconds]
grenierm has joined #ruby
goldfish has quit [Remote host closed the connection]
goldfish has joined #ruby
goldfish has quit [Remote host closed the connection]
stirl has quit [Ping timeout: 248 seconds]
beatif88 has joined #ruby
swaggboi has quit [Ping timeout: 256 seconds]
swaggboi has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
nirvdrum has joined #ruby
dviola has left #ruby [WeeChat 3.7.1]
<rapha> perhaps because it's "powered by polars"
dviola has joined #ruby
<leftylink> perhaps https://github.com/ankane/polars-ruby/blob/master/lib/polars.rb#L3-L5 gives a clue as to how it accomplishes this task. it will be neccesary to verify that the compiled version does in fact go in the place so designated
BSaboia has quit [Quit: ZNC - https://znc.in]
BSaboia has joined #ruby
<leftylink> as we can see, if it doesn't find a compiled version in the place where it should be it actually falls back on a pure Ruby impl
swaggboi has quit [Ping timeout: 246 seconds]
swaggboi has joined #ruby
FetidToot has quit [Ping timeout: 248 seconds]
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #ruby
apteryx has quit [Ping timeout: 265 seconds]
shokohsc has quit [Ping timeout: 250 seconds]
shokohsc has joined #ruby
FetidToot has joined #ruby
razetime has joined #ruby
apteryx has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Linux_Kerio has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
Sankalp has joined #ruby
razetime has quit [Ping timeout: 250 seconds]
<rapha> oh, sorry tsujp ... i completely misread "calling" as "called"
beatif88 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
_ht has joined #ruby
razetime has joined #ruby
<cxl> Hi all, why is the MyGem::VERSION string frozen, usually? i.e. why use '1.0.0'.freeze rather than just '1.0.0'?
<leftylink> I can't say why other gem authors do it, but I would do it for my gems so that someone doesn't accidentally mutate the string, and now nobody knows what the version of my gem is
<rapha> also in general, whenever you type a string, that's a whole new String object. but when all your strings are frozen, then there'll only be one single String object and it'll get re-used internally.
<rapha> wait, wasn't it supposed to become the default from 3.0 onwards for strings to be frozen?
___nick___ has joined #ruby
grenierm has quit [Ping timeout: 260 seconds]
razetime has quit [Remote host closed the connection]
antipr4 has joined #ruby
moldorcoder7 has quit [Ping timeout: 256 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
clemens3 has quit [Quit: WeeChat 2.7]
clemens3 has joined #ruby
litera53 has joined #ruby
antipr4 has quit [Ping timeout: 246 seconds]
pausel7 has joined #ruby
litera53 has quit [Ping timeout: 256 seconds]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
litera53 has joined #ruby
pausel7 has quit [Ping timeout: 255 seconds]
antipr4 has joined #ruby
litera53 has quit [Ping timeout: 256 seconds]
szkl has joined #ruby
antipr4 has quit [Ping timeout: 264 seconds]
antipr4 has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
litera53 has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
antipr4 has quit [Ping timeout: 255 seconds]
___nick___ has joined #ruby
litera53 has quit [Ping timeout: 265 seconds]
razetime has joined #ruby
antipr4 has joined #ruby
litera53 has joined #ruby
antipr4 has quit [Ping timeout: 248 seconds]
pausel7 has joined #ruby
litera53 has quit [Ping timeout: 252 seconds]
_ht has quit [Remote host closed the connection]
_ht has joined #ruby
mooff has quit [Quit: Ping timeout (120 seconds)]
mooff has joined #ruby
cybniv has joined #ruby
nirvdrum has quit [Read error: Connection reset by peer]
nirvdrum_ has joined #ruby
_ht has quit [Remote host closed the connection]
niv has quit [Ping timeout: 265 seconds]
_ht has joined #ruby
mooff has quit [Quit: Ping timeout (120 seconds)]
mooff has joined #ruby
micro has quit [Ping timeout: 260 seconds]
mooff has quit [Ping timeout: 250 seconds]
mooff has joined #ruby
micro has joined #ruby
litera53 has joined #ruby
Milos has quit [Ping timeout: 255 seconds]
antipr4 has joined #ruby
pausel7 has quit [Ping timeout: 256 seconds]
<ox1eef_> cxl: I would guess it has become common 'frozen_string_literal: true' magic comment is a linter default these days.
litera53 has quit [Ping timeout: 268 seconds]
litera53 has joined #ruby
Milos has joined #ruby
antipr4 has quit [Ping timeout: 265 seconds]
<ox1eef_> I have settled on Gem.version lately because if Gem is a module that is included then you also end up with the VERSION constant in scope which is weird to me.
<ox1eef_> rapha: I guess it did not happen:
<ox1eef_> ['foo'.frozen?, RUBY_VERSION]
<ox1eef_> => [false, "3.2.1"]
graywolf has joined #ruby
ollysmith has quit [Quit: ZNC 1.8.2+deb3+b4 - https://znc.in]
ollysmith has joined #ruby
NonatoAguiar has joined #ruby
NonatoAguiar39 has joined #ruby
<NonatoAguiar39> good afternoon people!
<NonatoAguiar39> please
<NonatoAguiar39> I have a field (slug) and I would like it to be filled in automatically by joining two other fields at the time of the create method. It would be possible? I've been testing with params but it didn't work.
NonatoAguiar has quit [Ping timeout: 260 seconds]
pausel7 has joined #ruby
litera53 has quit [Ping timeout: 256 seconds]
retroj has joined #ruby
pausel7 has quit [Ping timeout: 246 seconds]
clemens3 has quit [Ping timeout: 250 seconds]
<ox1eef_> NonatoAguiar39: [params[:foo],params[:bar]].join("-")
<NonatoAguiar39> thanks for answering, ox1eef_
<NonatoAguiar39> I had using inside the create method the following:
<NonatoAguiar39> ...
<NonatoAguiar39> @user.slug = "#{ params[:foo] } - #{ params[:bar] }"
<NonatoAguiar39> @user.slug.save
<NonatoAguiar39> less elegant (I'm a beginner), but should it work too?
<NonatoAguiar39> this in the controller
razetime has quit [Remote host closed the connection]
<ox1eef_> NonatoAguiar39: String does not have a .save method.
<ox1eef_> Is slug a column or an association ?
<NonatoAguiar39> column
<ox1eef_> Then it would be @user.save, and you should check the return value if @user.save to see if it was successful or not.
<ox1eef_> And, I think it would be better to have User.create_slug that took params[:foo] and params[:bar]. User input usually needs sanitized and validation, so even better would be to assign params[:foo] and params[:bar] to an instance of User, and hook into the lifecycle of ActiveRecord objects (before validation, validation, etc).
<NonatoAguiar39> not really, sorry I accidentally typed it, it's just @user.save mesemo
<NonatoAguiar39> not really, sorry I accidentally typed it, it's just @user.save anyway
<ox1eef_> No worries, but see the last message. User input normally needs sanitized and validated.
<ox1eef_> Also, there's this gem: https://github.com/norman/friendly_id
<ox1eef_> A naive, and simple slug implementation might be: [params[:foo], params[:bar]].compact.join("-").gsub(/[^A-Za-z0-9]/, '-')
<ox1eef_> Best to downcase as well (add .downcase to the end of it).
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 252 seconds]
desnudopenguino1 is now known as desnudopenguino
<NonatoAguiar39> I already have the friendly_id gem, but I didn't know that it joined two fields at the time of create. I'll try the options you said. Thank you very much.
uratom77 has joined #ruby
<ox1eef_> +1
egality has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 250 seconds]
desnudopenguino1 is now known as desnudopenguino
NonatoAguiar39 has quit [Quit: Client closed]
<myappie> if you have foreign letters and stuff you might wanna add:
<myappie> require "babosa"
<myappie> def normalize_friendly_id(string) string.to_slug.transliterate.normalize.downcase.to_s
<myappie> end
<myappie> after the FriendlyId part in your model
<myappie> i do it so i dont have to bother with i18n translations turning ie. "å" into "aa" instead of "a", "æ" into "ae" instead of "a" etc.
<myappie> oh he left
<ox1eef_> I think friendly_id includes babosa but with more bells and whistles.
<myappie> not transliteration afaik
<myappie> you can add transliteration manually to your locales, but that's gonna suck if you use i18n-tasks for automatic translating
<myappie> babosa seems to work more like an extension to friendly_id i think?
<myappie> if there was a separate i18n file only for transliterations, that'd solve the problem but it has to go into themain en.yml etc.
<ox1eef_> Not 100% sure. According to babosa README it was originally extracted from friendly_id.
<myappie> https://clbin.com/WZ1rW old way of doing it, but since babosa also supports tons of other languages that's also neat
<myappie> yeah i noticed that too, made me confused as well
<myappie> probably just referring to the slug generation part? :shrug:
<ox1eef_> If I was to choose I'd probably pick babosa because doesn't appear as coupled to AR.
moldorcoder7 has joined #ruby
<myappie> it'sonly concerned with transliteration of slugs in the models, so you can keep friendly id in your controllers untouched
<myappie> i wanna be certain of this too
NonatoAguiar has joined #ruby
<myappie> heres how i use it (for posts for improved SEO)
<myappie> ox1eef_: pls ping me if/when you find out for sure tho
drainpipe has joined #ruby
drainpipe has quit [Client Quit]
desnudopenguino has quit [Read error: Connection reset by peer]
desnudopenguino has joined #ruby
<ox1eef_> As far as I can see friendly_id is glue between slugs, and ActiveRecord. Babosa on the other hand leaves providing the glue in your hands.
<ox1eef_> To use Babosa with friendly_id: https://github.com/norman/babosa#other-stuff
<ox1eef_> Ah, your example looks to be doing that already.
roshanavand__ has joined #ruby
roshanavand has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 250 seconds]
desnudopenguino1 is now known as desnudopenguino
roshanavand__ has quit [Ping timeout: 255 seconds]
roshanavand has quit [Ping timeout: 265 seconds]
stirl has joined #ruby
uratom77 has quit [Ping timeout: 265 seconds]
NonatoAguiar has quit [Ping timeout: 260 seconds]
drap3r has joined #ruby
Pixi has quit [Quit: Leaving]
Pixi has joined #ruby
retroj has quit [Ping timeout: 260 seconds]
roshanavand has joined #ruby
roshanavand__ has joined #ruby
___nick___ has quit [Ping timeout: 265 seconds]
shokohsc1 has joined #ruby
shokohsc has quit [Ping timeout: 250 seconds]
shokohsc1 is now known as shokohsc
joast has quit [Ping timeout: 250 seconds]
_ht has quit [Quit: _ht]
graywolf has quit [Ping timeout: 265 seconds]
inspis61 has joined #ruby
TomyLobo2 has joined #ruby
TomyWork has quit [Ping timeout: 260 seconds]
apteryx has quit [Ping timeout: 250 seconds]
apteryx has joined #ruby
awfulhacker has joined #ruby
<awfulhacker> >> x = ["G", "I", "N", "G", "E", "R"];print (x[0...3].reverse + x[3..-1]).join("")
<ruby[bot]> awfulhacker: # => NIGGERnil (https://carc.in/#/r/eqhv)
<rapha> good god, again?
<rapha> how did this work...
<awfulhacker> bad bot
<rapha> !troll awfulhacker
tomtmym has quit [Quit: Gone.]
<sam113101> get rid of the print
<awfulhacker> x = ["G", "I", "N", "G", "E", "R"];print (x[0...3].reverse + x[3..-1]).join("") while true
<awfulhacker> >> x = ["G", "I", "N", "G", "E", "R"];print (x[0...3].reverse + x[3..-1]).join("") while true
<ruby[bot]> awfulhacker: # => (https://carc.in/#/r/eqhy)
<awfulhacker> >> print 10.times "HELLO"
<ruby[bot]> awfulhacker: # => wrong number of arguments (given 1, expected 0) (ArgumentError) (https://carc.in/#/r/eqi2)
<awfulhacker> >> 10.times { print "HELLO"}
<ruby[bot]> awfulhacker: # => HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLO10 (https://carc.in/#/r/eqi3)
<awfulhacker> >> x = ["G", "I", "N", "G", "E", "R"];while true do print (x[0...3].reverse + x[3..-1]).join("") + " ";
<ruby[bot]> awfulhacker: # => (https://carc.in/#/r/eqi5)
<awfulhacker> >> x = ["G", "I", "N", "G", "E", "R"];while true do print (x[0...3].reverse + x[3..-1]).join("") + " " end;
<ruby[bot]> awfulhacker: # => (https://carc.in/#/r/eqi6)
<awfulhacker> >> x = ["G", "I", "N", "G", "E", "R"]; 1000.times { print (x[0...3].reverse + x[3..-1]).join("") + " " };
<ruby[bot]> awfulhacker: # => NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NIGGER NI ...check link for more (https://carc.in/#/r/eqi7)
<awfulhacker> naughty bot
<rapha> jhass[m]: ping?
awfulhacker was banned on #ruby by adam12 [awfulhacker!*@*]
awfulhacker was kicked from #ruby by adam12 [awfulhacker]
inspis61 has quit [K-Lined]
<adam12> O_o
<weaksauce> thx
<rapha> thx
inspis61 has joined #ruby
inspis61 has quit [K-Lined]
roshanavand__ has quit [Ping timeout: 268 seconds]
roshanavand has quit [Ping timeout: 268 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
jess has joined #ruby
<adam12> jess: hiii
NonatoAguiar has joined #ruby
chapar60 has joined #ruby
<chapar60> awfulhacker is gone?
<chapar60> >> a="RUBY"; puts "<KEN>"+a[-4]+" "+a[-3]+" "+a[0]+a[3]+a[1]+"?"
chapar60 has quit [K-Lined]
wiseac42 has joined #ruby
wiseac42 has quit [K-Lined]
toxico has joined #ruby
toxico has quit [K-Lined]
desnudopenguino1 has joined #ruby
hymnar70 has joined #ruby
hymnar70 has quit [K-Lined]
desnudopenguino has quit [Ping timeout: 276 seconds]
desnudopenguino1 is now known as desnudopenguino
John_Ivan has quit [Quit: Phantom of the future.]
drap3r has quit [Quit: Connection closed for inactivity]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino