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!
banisterfiend has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
jetchisel has quit [Ping timeout: 264 seconds]
jetchisel has joined #ruby
jetchisel has quit [Client Quit]
patrick99e99 has quit [Quit: Lost terminal]
chalkmonster has quit [Quit: WeeChat 2.8]
dviola has quit [Quit: WeeChat 2.8]
gell5 has quit [Remote host closed the connection]
gell5 has joined #ruby
gell5 has quit [Remote host closed the connection]
gell5 has joined #ruby
arahael has quit [Ping timeout: 256 seconds]
gell5 has quit [Remote host closed the connection]
gell5 has joined #ruby
gell5 has quit [Remote host closed the connection]
gell5 has joined #ruby
gell5 has quit [Remote host closed the connection]
arahael has joined #ruby
teclator has quit [Ping timeout: 265 seconds]
teclator has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phage has joined #ruby
phage has quit [Ping timeout: 256 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
poro has joined #ruby
troulouliou_div2 has joined #ruby
envex has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 260 seconds]
kristian_on_linu has quit [Remote host closed the connection]
chalkmonster has joined #ruby
rubydoc has quit [Ping timeout: 260 seconds]
xco has joined #ruby
phaul has quit [Ping timeout: 272 seconds]
TCZ has quit [Quit: Leaving]
jenrzzz has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 258 seconds]
phaul has joined #ruby
rubydoc has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
xco has joined #ruby
imode has quit [Ping timeout: 260 seconds]
gix has quit [Ping timeout: 265 seconds]
rmnull has joined #ruby
<rmnull> hi, what is the recommended way to contribute to ruby documentation? i went through docs and ended up here http://documenting-ruby.org/(https://github.com/documenting-ruby/ruby) but this project dont seem active since 2015
imode has joined #ruby
troulouliou_div2 has quit [Remote host closed the connection]
cd has quit [Quit: cd]
<havenwood> rmnull: I'd suggest following regular contribution steps. https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute
<havenwood> rmnull: For a tiny fix, a PR to GitHub suffices. For anything that might need discussion, a patch and issue on bugs.ruby-lang.org is customary.
<rmnull> thanks, i'll take a look
orbyt_ has joined #ruby
ChmEarl has quit [Quit: Leaving]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 264 seconds]
poro has quit [Quit: Leaving]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
donofrio has quit [Remote host closed the connection]
Guest93362 is now known as baweaver
baweaver has quit [Changing host]
baweaver has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 246 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 256 seconds]
phage has joined #ruby
envex has quit []
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
ur5us has joined #ruby
gix has joined #ruby
nicholaslyang has joined #ruby
gix has quit [Ping timeout: 264 seconds]
teclator has quit [Ping timeout: 246 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teclator has joined #ruby
howdoi has joined #ruby
phage has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alexherbo2 has joined #ruby
conta has joined #ruby
rmnull has quit [Read error: Connection reset by peer]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 256 seconds]
kristian_on_linu has joined #ruby
phage has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
DTZUZU has quit [Ping timeout: 244 seconds]
phage has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
gell5 has joined #ruby
phage has joined #ruby
ldepandis has joined #ruby
gell5 has quit [Ping timeout: 256 seconds]
phage has quit [Ping timeout: 264 seconds]
cnsvc_ has joined #ruby
sarna has joined #ruby
<sarna> hello, I can't install ruby 2.7.1 with rbenv. it's stable - then why can't I install it? it's not even listed as installable
<jhass> sarna: it does seem to have been added to ruby-build https://github.com/rbenv/ruby-build/commit/d45c4ed624812e27317c98b174bd4debd39a80f7
<jhass> maybe you need to update thins?
* jhass not a rbenv user
<sarna> jhass: yep, had to upgrade ruby-build manually. thanks :)
sh7d has quit [Ping timeout: 260 seconds]
<sarna> by the way - when people write ruby scripts (I mean one-file programs), do they make, like, a Main class or something? or just put everything at the top-level
sh7d has joined #ruby
akem has quit [Quit: Leaving]
akem has joined #ruby
<jhass> can't say there's a definitive way
<jhass> I have roughly three styles depending on complexity, long-levity and target audience. From just a bunch of top level code to cleaning that up with some method definitions to a full class based design as you say
<jhass> for a gem offering a CLI it can often make sense to have your top level code be something like MyGem::CLI.new(ARGV) for testability primarily but also reusability
<sarna> I see. thanks!
<jhass> also these categories don't have clear borders to me. category 2 especially might sport some small entity classes or put the methods in a class to have common state etc.
<jhass> just do what looks good to you :)
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sarna> I spent some time writing go and python, I must relearn how not to overgeneralize everythin :)
<jhass> nah, don't :)
<jhass> just forget to make everything super explicit, assume some things are the way you need them to be :D
jenrzzz has quit [Ping timeout: 258 seconds]
DTZUZU has joined #ruby
<sarna> I just migrated one script to ruby, felt super nice :) though probably not 100% idiomatic yet, but still I enjoyed the process
sarna has quit [Quit: Connection closed]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
imode has quit [Ping timeout: 246 seconds]
vondruch has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
dionysus69 has joined #ruby
conta has quit [Quit: conta]
snuz has joined #ruby
sarna has joined #ruby
jenrzzz has joined #ruby
tau has quit [Ping timeout: 265 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc_ has joined #ruby
darkstardev13 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc_ has quit [Ping timeout: 240 seconds]
TomyWork has joined #ruby
ur5us has joined #ruby
Bounga has joined #ruby
<sarna> `data.map{ |row| row['foo']}.to_set` <- how would I format this?
gell5 has joined #ruby
<yxhuvud> personally I tend to put chained method calls on consecutive lines, but what you have is fine too
<leftylink> almost exactly like that, but I additionally put a space before the opening brace and before the closing brace
gell5 has quit [Ping timeout: 260 seconds]
<sarna> okay, thanks :)
al2o3-cr has quit [Quit: WeeChat 2.8]
<sarna> one more question - why is the "filter" family of methods mutating-only? I mean filter!, select!, keep_if
<yxhuvud> Becuase you have added a ! to the end of them. Try without.
<sarna> oh! why aren't the regular ones listed in the docs?
<yxhuvud> what docs are you looking at?
al2o3-cr has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<yxhuvud> Probably because that page only seems to list stuff defined in the class itself, and not the stuff it gets from modules. See https://ruby-doc.org/core-2.7.1/Enumerable.html
jenrzzz has quit [Ping timeout: 256 seconds]
<sarna> ohh I see! thanks a lot :)
jenrzzz has joined #ruby
darkstardev13 has quit [Remote host closed the connection]
darkstardev13 has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
darkstardev13 has quit [Remote host closed the connection]
darkstardev13 has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
roadie has joined #ruby
infinityfye has joined #ruby
fercell has joined #ruby
conta has joined #ruby
snuz has quit [Read error: Connection reset by peer]
<Cork> anyone know what's up with bundler and rubygems.org?
quazimodo has joined #ruby
gell5 has joined #ruby
AndreYuhai has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
gell5 has quit [Ping timeout: 264 seconds]
kinduff has joined #ruby
<sarna> seems like bundler is now included in the rubygems framework thingy?
<Cork> na, it was my isp that mocked up ipv6 again
<Cork> forcing ipv4 for rubygems.org helped
<AndreYuhai> Hey there, how do I create this association: https://dbdiagram.io/d/5ede1f879ea313663b3a35e7 in Rails? I got confused. Should I go with has_and_belongs_to_many? I included explanation in the comments there.
<sarna> oh well, I was confused since both were up for me :D
schne1der has joined #ruby
<Cork> AndreYuhai: either has_and_belongs_to_many or a separate relation model
<Cork> sarna: ya, i find it a bit weird that bundle doesn't fallback to ipv4 if ipv6 fails
<AndreYuhai> Cork, how would be a separate one? If I didn't want badges to have users.
<Cork> AndreYuhai: users.users_basgers.first.badge
<Cork> i would prob rename the table for that though
<sarna> Cork: yeah, that sounds weird.. but I wouldn't know how other services behave, I've never used ipv6 :)
<Cork> sarna: ya it is a bit mixed, browsers and curl fallback, wget doesn't
<Cork> for example
<sarna> Cork: darn, and I thought wget was the cooler one
<Cork> as far as i know curl is always trying to stay ontop of the ball
<Cork> as long as one run the latest version at least :)
<Cork> wget can't even download to resource provided file names
<sarna> :(
<Cork> well they added an option a few versions back when they do it through two http requests
<Cork> but it is a gigantic hack
jenrzzz has joined #ruby
conta has quit [Quit: conta]
jenrzzz has quit [Ping timeout: 260 seconds]
gell5 has joined #ruby
TCZ has joined #ruby
gell5 has quit [Ping timeout: 240 seconds]
donofrio has joined #ruby
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
quazimodo has quit [Ping timeout: 246 seconds]
ldepandis has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
<Cork> anyone know if there is a ip to host formatter in ruby somewhere? (that puts the [] around ipv6 addresses)
funnel has quit [Ping timeout: 260 seconds]
funnel has joined #ruby
LenPayne has quit [Quit: ZNC 1.7.5 - https://znc.in]
LenPayne has joined #ruby
gell5 has joined #ruby
TCZ has quit [Quit: Leaving]
funnel has quit [Ping timeout: 246 seconds]
funnel has joined #ruby
cnsvc_ has joined #ruby
sarna has quit [Quit: Connection closed]
ellcs1 has joined #ruby
<AndreYuhai> is there any way to recursively create objects from a hash within a hash or hashes within an array for an active record model or do I need to do that manually in my class' initialize method? https://dpaste.org/TJk3
<apotheon> I think wget as a whole is a gigantic hack, as are most GNU things.
salerace has joined #ruby
salerace has quit [Quit: salerace]
salerace has joined #ruby
salerace has quit [Client Quit]
salerace has joined #ruby
salerace has quit [Client Quit]
salerace has joined #ruby
<adam12> AndreYuhai: I doubt you could use that Hash as-is, but ActiveRecord can create nested objects. You'd need to enable it with `accepts_nested_attributes_for :badges`.
simi[m] has joined #ruby
<adam12> AndreYuhai: You could make your own initializer (class method that calls new) which accepts the hash, transforms it, then creates a new User.
xco has joined #ruby
<AndreYuhai> adam12, yes what I've come up with was this: https://dpaste.org/B1n3
<AndreYuhai> I was just wondering whether ActiveRecord already supports what I am trying to do. I will check that accepts_nested_attributes_for thing though. Thank you.
rippa has joined #ruby
cd has joined #ruby
jenrzzz has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
salerace has quit [Quit: salerace]
jenrzzz has quit [Ping timeout: 256 seconds]
conta has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Ping timeout: 256 seconds]
ChmEarl has joined #ruby
abhijit_ has joined #ruby
<abhijit_> Hi
<abhijit_> Padrino is loading my models/settings multiple times. any points on how can I troubleshoot it?
fercell has quit [Quit: WeeChat 2.8]
bga57 has quit [Ping timeout: 272 seconds]
edwardly has joined #ruby
edwardly has joined #ruby
bga57 has joined #ruby
s2013 has joined #ruby
abhijit_ has quit [Ping timeout: 246 seconds]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
orbyt_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FastJack has quit [Ping timeout: 240 seconds]
duderonomy has joined #ruby
FastJack has joined #ruby
greengriminal has quit [Quit: Leaving]
Emmanuel_Chanel has quit [Quit: Leaving]
poro has joined #ruby
poro has quit [Client Quit]
reaVer has joined #ruby
Emmanuel_Chanel has joined #ruby
TCZ has joined #ruby
poro has joined #ruby
howdoi has joined #ruby
<jhass> mmh, maybe putting p(caller) into the file that's loaded multiple times does something? I never tried
infinityfye has quit [Read error: Connection reset by peer]
akem has quit [Ping timeout: 260 seconds]
infinityfye has joined #ruby
nicholaslyang has joined #ruby
jenrzzz has joined #ruby
akem has joined #ruby
TomyWork has quit [Remote host closed the connection]
FastJack has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 246 seconds]
bga57 has quit [Ping timeout: 246 seconds]
Bounga has quit [Ping timeout: 272 seconds]
sandstrom has joined #ruby
sandstrom has quit [Client Quit]
bga57 has joined #ruby
sandstrom has joined #ruby
reyfi9e has joined #ruby
jenrzzz has joined #ruby
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
sandstrom has quit [Quit: sandstrom]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 246 seconds]
xco has joined #ruby
davispuh has joined #ruby
duderonomy has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
duderonomy has joined #ruby
troulouliou_div2 has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
darkstardev13 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
poro has quit [Quit: Leaving]
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
SeepingN has joined #ruby
xco has quit [Ping timeout: 256 seconds]
Bounga has joined #ruby
troulouliou_div2 has quit [Remote host closed the connection]
nychtel has joined #ruby
<nychtel> Heya all!
<nychtel> I have an interesting question regarding Marshal, and symbols converted to strings
<nychtel> Marshal.dump("hi") !== Marshal.dump((:hi).to_s)
<nychtel> Why?
<jhass> Why would it be? Marshal preservices symbols :)
<jhass> *preserves, even
<apotheon> erm
<apotheon> to_s
<jhass> on the .dump, not on a dump(load)
<apotheon> Shouldn't the argument to Marshall.dump be a string?
<jhass> er, load(dump)
<apotheon> Oh, I see what you're saying.
<apotheon> hmm
<apotheon> That's an interesting way of looking at it.
<jhass> is it?
<jhass> &>> [Marshal.dump("hi"), Marshal.dump(:hi), Marshal.load(Marshal.dump("hi")), Marshal.load(Marshal.dump(:hi))]
<rubydoc> # => ["\x04\bI\"\ahi\x06:\x06ET", "\x04\b:\ahi", "hi", :hi] (https://carc.in/#/r/98g8)
<jhass> I see nothing surprising
<nychtel> Yeah! I see nothing surprising too
<nychtel> Now.... MD% it
<nychtel> md5
<nychtel> => "\x04\bI\"\ahi\x06:\x06EF"
<nychtel> 2.7.1 :030 > str2 = Marshal.dump(a)
<nychtel> => "hi"
<nychtel> 2.7.1 :032 > str2
<nychtel> 2.7.1 :031 > a
<nychtel> => "\x04\bI\"\ahi\x06:\x06ET"
<jhass> it's different hashes obviously, you can already spot the data being different
<nychtel> Last letter - the symbol one ends in T and the string one ends in F
<jhass> ?gist
<nychtel> right, but what shouldn't be different is when you convert the symol to a string
<nychtel> it should just be "hi", and in fact it seems to be
<nychtel> it compares equal to the original string
<nychtel> but the MD5 of the marshal is different -- the marshal was just passed a string as well
<jhass> well yes, that has nothing to do with marshal
<nychtel> well if you md5 the strings, they match
<jhass> Got an example of what you mean? Preferably in https://carc.in/#/rb
<nychtel> actually sorry, you're right: marshal isn't the problem
<nychtel> K, on it
jenrzzz has joined #ruby
<nychtel> There we go
<jhass> let's add printing https://carc.in/#/r/98gl
<jhass> both return true, contra your comments
<nychtel> Hmmm.... It's running 2.7.0 and I'm running 2.7.1
<nychtel> On my machine that's false in both spots
<nychtel> on my coworker's machine (he started all this!!!) it also borks - also 2.7.1
<nychtel> Tried it on 2.7.0 (for once I'm thankful for rvm!) -- still doesn't work
<nychtel> ... weeeird....
<jhass> mh, indeed
<jhass> my local 2.6.3 returns false as well
<nychtel> Hmmm... he's actually running 2.6.1
lucasb has joined #ruby
<nychtel> (btw I appreciate the help - this has me pretty stumped
<nychtel> )
<nychtel> https://repl.it/languages/ruby <-- running 2.5.5, same problem
Bounga has quit [Remote host closed the connection]
Bounga has joined #ruby
<nychtel> Huh. I wonder if it has something to do with using reallocated space for the symbol. Like, when Marshal serializes it, it includes the size of the object's allocated space
<jhass> maybe? Idk. Maybe it just was a bug in 2.7.0 to return true? :D
<jhass> I never digged into the marshal format, I think it's documented as something you should treat opaque
<nychtel> I tried using .freeze on them, in case that'd free up any excess memory
<nychtel> no dice
<nychtel> Yeah, the format for object serialization should always be treated as a black box unless you're actively working on it
sauvin has quit [Read error: Connection reset by peer]
<nychtel> Actually jhass it can't be just 2.7.0 because I tried that here on my machine
<nychtel> 2.7.1, 2.7.0, and 2.6.1
<nychtel> 2.6.5 and 2.5.5 online, and just the one 2.7.0 that worked. I wonder if the one that worked was pure ruby and the ones that didn't had some kind of gem polluting them.
FastJack has joined #ruby
<jhass> idk, it's all very much the same, archlinux host, archlinux container, archlinux package
<jhass> my archlinux laptop with 2.7.1 also gives false
<nychtel> I noticed it didn't know about the Digest module, so I just wonder if in the name of purity they left out anything other than barebones ruby
<nychtel> I don't know: should I submit a bug report or something? I can't find this behavior documented or discussed anywhere
<jhass> (fwiw I run carc.in, so not sure if you mean me or the archlinux packager)
<jhass> I mean it's documented that you basically should have no expecations of the output other than Marshal.load returning what you had put in?
<nychtel> I assumed you run it since you knew what was under the hood. I was just suggesting the bug may be in some gem that isn't included on the server.
<nychtel> Though that sounds unlikely - a gem modifying something core like that
<jhass> yeah
<nychtel> We were really hoping we could md5 the marshal dump to store heavy lifting from reports into redis in a simple way.
<nychtel> I suggested we use something else as the key but the bossman seems pretty set on doing it this way if possible
<jhass> what kind of object do you marshal?
<jhass> maybe you can hash what you input instead?
dretnx has joined #ruby
<jhass> nychtel: ah! It's encoding!
<nychtel> Yeah, I suggested that but he was hoping to store some relations that are pretty heavyweight to compute
<nychtel> I tried .encoding, I swear!
<jhass> US-ASCII vs UTF-8 for me
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<nychtel> Huh. On my end they're both ASCII
<jhass> it kinda makes sense, I fixed carc.in to force encodings to UTF-8 at some point but probably never applied that to the older ruby containers
<jhass> so it interacts with the external encoding (ruby -E)
<nychtel> Weird. I still get the problem on my end. The encodings are ==, but the dumps aren't
<nychtel> I thought of encoding almost first thing. Weird that was actually the problem on your end :)
<jhass> or maybe I did, actually all the carc.in's return true
conta1 has joined #ruby
<nychtel> Marshal.dump(String('rent_active_on').freeze).encode("iso-8859-1").force_encoding("utf-8") == Marshal.dump(String(:rent_active_on).freeze).encode("iso-8859-1").force_encoding("utf-8")
<nychtel> still false here :(
conta has quit [Ping timeout: 246 seconds]
conta1 is now known as conta
dretnx has quit [Remote host closed the connection]
<nychtel> Hhhmmmmmm, ok
jenrzzz has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
conta has quit [Client Quit]
fercell has joined #ruby
<jhass> but yeah, I have to agree that hashing marshal output seems brittle
<jhass> maybe you could seralize to a more standardized format, JSON/YAML (still brittle, might have whitespace changes), JSONB/MsgPack/Protobuf/... id
<jhass> *idk
<nychtel> Yeah I'm not the coolest with that idea :)
hightower4 has quit [Ping timeout: 240 seconds]
<nychtel> Yeah, the problem with a lot of those more standardized ones is they can't handle ruby code as well
conta has joined #ruby
<jhass> some might argue that as an additional benefit :D
<nychtel> cool, thanks jhass
<jhass> yw, was fun one
<nychtel> I found one other way around it: interpolation
<jhass> well
<nychtel> "#{:symbol}"
<jhass> whatever works for you :D
<nychtel> jhass - some might argue that: I'm one of those some :)
<nychtel> Storing executable code is rarely a good idea, but I suppose it's really just a caching mechanism so if something goes wrong we can catch it and just do the full report : ... sloooooowly
<nychtel> I think the issue has to do with the character encoding of the ruby code vs. the character encoding of the system it's running on.
drincruz has joined #ruby
<jhass> yeah, hence carc.in is unaffected because it invokes ruby -E UTF-8
<jhass> and internal default is UTF-8 since 2.0
<AndreYuhai> Am I doing something wrong using `accepts_nested_attributes_for` here: https://dpaste.org/fvw0 ?
<jhass> that symbol.to_s would use the exernal encoding is strange though
<adam12> AndreYuhai: The hash key is book_attributes
cliluw has joined #ruby
<adam12> AndreYuhai: Author.new({name: "Foo", book_attributes: { name: "Ruby" }})
nicholaslyang has joined #ruby
<AndreYuhai> Ooooh we gotta change the key as well.
<AndreYuhai> That's sad. :D
<AndreYuhai> adam12, Thank you! :)
<adam12> AndreYuhai: np :)
nicholaslyang has quit [Quit: Textual IRC Client: www.textualapp.com]
nicholaslyang has joined #ruby
Bounga has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
SuperLag has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
TCZ has quit [Quit: Leaving]
infinityfye has quit [Ping timeout: 240 seconds]
cnsvc_ has joined #ruby
Deesl has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mistergibson has joined #ruby
TCZ has joined #ruby
FastJack has quit [Ping timeout: 260 seconds]
FastJack has joined #ruby
conta has quit [Quit: conta]
nicholaslyang has joined #ruby
poro has joined #ruby
alexherbo2 has joined #ruby
gix has joined #ruby
imode has joined #ruby
SuperL4g has joined #ruby
SuperLag has quit [Ping timeout: 265 seconds]
Deesl has quit [Quit: Textual IRC Client: www.textualapp.com]
poro has quit [Quit: Leaving]
tau has quit [Ping timeout: 260 seconds]
chris____ has joined #ruby
SuperLag has joined #ruby
gix has quit [Ping timeout: 264 seconds]
SuperL4g has quit [Ping timeout: 265 seconds]
gix has joined #ruby
jenrzzz has joined #ruby
SuperL4g has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
Secret-Fire has quit [Ping timeout: 240 seconds]
SuperLag has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
fratis has joined #ruby
Secret-Fire has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schne1der has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
fratis has quit [Read error: Connection reset by peer]
SuperLag has joined #ruby
matti has quit []
matti has joined #ruby
SuperL4g has quit [Ping timeout: 240 seconds]
ellcs1 has quit [Ping timeout: 256 seconds]
dionysus69 has quit [Ping timeout: 246 seconds]
cnsvc_ has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
Bounga has joined #ruby
xco has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jetchisel has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
cnsvc_ has joined #ruby
imode has quit [Ping timeout: 260 seconds]
tau has joined #ruby
tau has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
orbyt_ has joined #ruby
<xco> hello everyone. when i do `$SAFE` in irb i get $SAFE will become a normal global variable in Ruby 3.0
<xco> question: $SAFE is not normal? how's that?
<xco> i mean how's $SAFE not a normal global variable, what is a "normal" global variable?
<akem> What will replace $SAFE?
<xco> akem mmm, not sure i get it. what will replace $SAFE? i don't know.
<akem> xco, SAFE is used to protect execution of stuff that is considered dangerous IIRC.
<akem> $SAFE
<xco> akem yup that i know
nicholaslyang has joined #ruby
<akem> xco, That's why it is not a normal variable.
cnsvc_ has quit [Ping timeout: 240 seconds]
<akem> xco, What version of ruby are you running?
<xco> 2.7.1 akem
<akem> Ok, i run 2.7.0 here, that's why i don't have the warning.
<xco> akem hm, i switched to 2.7.0 with IRB, and i still have "(irb):1: warning: $SAFE will become a normal global variable in Ruby 3.0"
<xco> IRB = RVM sorry
<akem> xco, Yeah, i have the warning in fact.
<akem> in IRB at least
<xco> yeah so a follow-up question will be is "$!" a "normal" global variable? if so why is $SAFE not a normal one. this is what i'm trying to understand
<akem> What is "$!" usage?
<xco> it shows the latest error message
<akem> xco, How i understand it, you cannot use $SAFE for your own purpose, it is already interpreted by the ruby language.
<xco> akem i think you can
<akem> Ha ok. I never use it, nm. :P Good to know.
<xco> you can manipulate it to your purpose
<akem> xco, You can, but it will also change ruby behavior related to execution at the same time.
<akem> Because internal ruby stuff look at this variables' value already.
<xco> akem yes, then you can hide it in a proc so it doesn't leak outside
gell5 has quit [Remote host closed the connection]
gell5 has joined #ruby
claw has quit [Ping timeout: 246 seconds]
claw has joined #ruby
Bounga has quit [Ping timeout: 272 seconds]
roadie has quit [Ping timeout: 272 seconds]
nofxx__ has quit [Remote host closed the connection]
nofxx__ has joined #ruby
<AndreYuhai> How to find by a nested model's id in rails? https://dpaste.org/L9wL
dhollinger has quit [Ping timeout: 265 seconds]
dhollinger has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
jenrzzz has joined #ruby
TCZ has quit [Ping timeout: 260 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cyrus_mc_ has joined #ruby
<cyrus_mc_> Wondering if someone can provide me some quick feedback (not a ruby developer). https://github.com/drbrain/net-http-persistent/commit/5d4b76c22dd38d29b6fbc1ed700a2a1c78c5abc4 - was researching a bug related to fluentd and found it was related to the net-http-persistent library. Version 2.x (on the left) works whereas 3.x (right) doesn't. The code
<cyrus_mc_> in question calls @http = Net::HTTP::Persistent.new 'fluent-plugin-logzio', :ENV and that results in unexpected error error_class=ArgumentError error="wrong number of arguments
<cyrus_mc_> Trying to understand why, what is the difference when defining a method parameters as name = nil vs name: nil
drincruz has quit [Ping timeout: 260 seconds]
<havenwood> cyrus_mc_: The latter is called a keyword argument.
<havenwood> cyrus_mc_: The former determines the variable by its position, like if it's first or second. The new version determines the variable by its name, like: name: 'fluent-plugin-logzio'
<cyrus_mc_> Ah. so when the code that is broken calls @http = Net::HTTP::Persistent.new 'fluent-plugin-logzio', :ENV it should be calling it how?
<havenwood> cyrus_mc_: TL;DR: @http = Net::HTTP::Persistent.new name: 'fluent-plugin-logzio', proxy: :ENV
<cyrus_mc_> ty
<havenwood> np
<cyrus_mc_> Last quick question if you don't mind. https://github.com/logzio/fluent-plugin-logzio/blob/master/lib/fluent/plugin/out_logzio_buffered.rb is the code in question. Which I don't own. If you wanted to make this code work in both cases (whether using version 2.x or 3.x of the library) is there a way to do that
<havenwood> cyrus_mc_: Yes. You could check the arguments of the method, or I'd be inclined to just check the net-http-persistent version.
<cyrus_mc_> k. Thanks again
cyrus_mc_ has quit [Quit: Connection closed]
<havenwood> cyrus_mc_: if Gem::Version.new(Net::HTTP::Persistent::VERSION) >= Gem::Version.new('4')
<leftylink> hmm
<leftylink> it occurs to my that my usual approach wouldn't work well here
<leftylink> basically it would cause me to be more of an asshole than helpful
<leftylink> I should adjust in such a situation
<leftylink> when appropriate.
gell5 has quit [Remote host closed the connection]
nychtel has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
bga57 has quit [Ping timeout: 256 seconds]
mistergibson has quit [Quit: Leaving]
bga57 has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
teclator has quit [Ping timeout: 246 seconds]
teclator has joined #ruby
gdonald has quit [Quit: Lost terminal]
AndreYuhai has quit [Quit: Leaving]
chris____ has quit [Remote host closed the connection]
gell5 has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby