jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
jpn has quit [Ping timeout: 268 seconds]
onyx has quit [Read error: Connection reset by peer]
relyks has quit [Ping timeout: 256 seconds]
relyks has joined #ruby
foxxesStar has quit [Ping timeout: 260 seconds]
John_Ivan_ has quit [Remote host closed the connection]
John_Ivan_ has joined #ruby
John_Ivan_ has quit [Read error: Connection reset by peer]
John_Ivan_ has joined #ruby
foxxesStar has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 264 seconds]
s-liao-2000 has joined #ruby
markong has quit [Ping timeout: 264 seconds]
s-liao-2000 has quit [Quit: Client closed]
jhass has quit [Ping timeout: 244 seconds]
jhass has joined #ruby
gr33n7007h has quit [Ping timeout: 264 seconds]
duds- has quit [Excess Flood]
duds- has joined #ruby
duds- has quit [Excess Flood]
duds- has joined #ruby
comet23 has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
jpn has joined #ruby
duds-_ has joined #ruby
duds- has quit [Ping timeout: 264 seconds]
duds-_ is now known as duds-
jpn has quit [Ping timeout: 268 seconds]
sam113101 has quit [Quit: WeeChat 3.4]
s-liao-2000 has joined #ruby
sam113101 has joined #ruby
jpn has joined #ruby
jl- has joined #ruby
comet23 has quit [Ping timeout: 252 seconds]
jl- has quit [Ping timeout: 260 seconds]
Ziyan has joined #ruby
gr33n7007h has joined #ruby
sn0rl5x has joined #ruby
davidw_ has quit [Ping timeout: 246 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
siery has joined #ruby
ur5us has quit [Ping timeout: 268 seconds]
Ziyan_ has joined #ruby
Ziyan has quit [Ping timeout: 268 seconds]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
Furai has quit [Quit: WeeChat 3.5]
Furai has joined #ruby
jpn has quit [Quit: Lost terminal]
_ht has joined #ruby
Pixi` has quit [Ping timeout: 255 seconds]
rvalue has quit [Ping timeout: 264 seconds]
mixfix41 has quit [Ping timeout: 264 seconds]
rvalue has joined #ruby
TomyWork has joined #ruby
FrankD has quit [Remote host closed the connection]
FrankD has joined #ruby
pottys8 has joined #ruby
pottys8 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
pvalenta has joined #ruby
siery has quit [Ping timeout: 255 seconds]
Ziyan has joined #ruby
Ziyan_ has quit [Ping timeout: 268 seconds]
Pixi has joined #ruby
jl- has joined #ruby
jl- has quit [Ping timeout: 246 seconds]
Jonopoly has joined #ruby
ur5us has joined #ruby
<Ziyan> I have a question about a code style (probably more appropriate in the Rails channel)... Writing service objects would you pass an ActiveRecord instance or its ID and find it inside the service object?
<Ziyan> `LevelUpUserService.perform(user: User.find(...))` vs `LevelUpUserService(user_id: user.id)`
<ox1eef_> i don't think there is rails channel, is there?
<ox1eef_> in any case, if that's a job, best to pass the id as it will be serialized, and serializing an AR object isnt desirable. takes up a lot of space.
<ox1eef_> if its not a job, best to pass the object directly otherwise you'll be calling the DB when there's no need.
<Ziyan> ox1eef_ There is this this `#rubyonrails` channel, there are a lot of people, no action. It dried up following the Freenode implosion.
<ox1eef_> roger that
<Ziyan> ox1eef_ yes, I forgot to mention the most important point, it is not a job. So that is what I thought. It is better to send it by reference. Also will save an extra instance of the object occupying memory.
Ziyan has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
s-liao-2000 has quit [Ping timeout: 252 seconds]
ur5us has quit [Quit: Leaving]
ur5us has joined #ruby
s-liao-2000 has joined #ruby
Ziyan has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
Ziyan has quit [Ping timeout: 268 seconds]
Ziyan has joined #ruby
markong has joined #ruby
jpn has joined #ruby
Ziyan has quit [Ping timeout: 240 seconds]
Ziyan has joined #ruby
relyks has left #ruby [#ruby]
jpn has quit [Ping timeout: 268 seconds]
jpn_ has joined #ruby
jpn has joined #ruby
jpn_ has quit [Ping timeout: 255 seconds]
ur5us has quit [Ping timeout: 268 seconds]
rvalue has quit [Ping timeout: 260 seconds]
reset has joined #ruby
rvalue has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
jpn has quit [Ping timeout: 255 seconds]
jpn has joined #ruby
<adam12> Ziyan: It probably doesn't matter much, but if your service was to become async via a job, then having a primary key parameter would likely be easier to migrate to.
<adam12> Ziyan: There's no "official" pattern for service objects tho, so I'd say just do what makes you happier. ActiveJob does fancy serialization so the transition might be seamless, regardless of the choice you make.
<adam12> Ziyan: But I'd probably prefer an object that accepted another object, and not just a primitive.
<adam12> You could probably get fancy with the service definition to accept both. `def self.perform(user: User.find(user_id), user_id: nil)` or something.
Ziyan has quit [Ping timeout: 264 seconds]
Ziyan has joined #ruby
Rounin has joined #ruby
gr33n7007h has quit [Ping timeout: 268 seconds]
jl- has joined #ruby
jl- has quit [Ping timeout: 268 seconds]
protektwar has quit [Ping timeout: 272 seconds]
jpn has quit [Ping timeout: 268 seconds]
dionysus69 has joined #ruby
Ziyan has quit [Ping timeout: 260 seconds]
Ziyan has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 255 seconds]
Ziyan_ has joined #ruby
Ziyan has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
wand has quit [Remote host closed the connection]
wand has joined #ruby
bit4bit has joined #ruby
sagax has quit [Read error: Connection reset by peer]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Ziyan has joined #ruby
Ziyan_ has quit [Ping timeout: 268 seconds]
sagax has joined #ruby
s-liao-2000 has quit [Quit: Client closed]
Jonopoly has quit [Quit: WeeChat 3.0]
davidw_ has joined #ruby
sn0rl5x has quit [Quit: Client closed]
gr33n7007h has joined #ruby
protektwar has quit [Ping timeout: 240 seconds]
<adam12> It's unfortunate that Sinatra has never shipped with it's own `flash` mechanism. It ships with everything else.
typeof[panda] has joined #ruby
Guest86 has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
Guest86 has quit [Quit: Client closed]
dionysus69 has joined #ruby
<pvalenta> hello, I am trying to create new rails app but it fails on building puma. I have probably too new openssl. Is possible somehow tell bundler to use puma installed from distribution? Version is the same so OpenSUSE has probably some patches to make puma compile.
<adam12> pvalenta: Can you share the error in a Gist or Pastebin?
polishdub has quit [Remote host closed the connection]
<adam12> pvalenta: There's no way to force bundler to use the system version of puma.
<adam12> pvalenta: Do you know if you have an older version of OpenSSL available on that version of OpenSUSE? Versioned under /usr/include (and /usr/lib)?
<adam12> pvalenta: If you have an older OpenSSL version available, you could try to force puma to use that for linking. You'd need to set a bundler config value that forces flags like these --with-cppflags=-I/usr/include/openssl-1.0 --with-ldflags=-L/usr/lib/openssl-1.0
<adam12> pvalenta: Alternatively, see if you can disable Puma from building SSL support using the same style of bundler config value.
<adam12> I don't remember the bundler config setting but I'm sure you can find it on bundler.io.
<pvalenta> adam12, I have found the cause of problem. postgresql-devel package has dependency libressl-devel. I have removed libressl-devel and posgres-devel packages a after instalation of libopenssl-devel all works.
<pvalenta> adam12, thank you for support
<adam12> pvalenta: Ah interesting. Good find.
Ziyan_ has joined #ruby
Ziyan has quit [Ping timeout: 268 seconds]
<rapha> hi all!
<adam12> rapha: ohai
<rapha> is there a one-liner way for making {foo: %w[a b], bar: %w[c d], baz: 'e'} into {foo1: 'a', foo2: 'b', bar1: 'c', bar2: 'd', baz: 'e'}
<rapha> (the best i can manage to do so far is two lines and using an ugly helper var)
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
bit4bit has quit [Ping timeout: 246 seconds]
bit4bit has joined #ruby
<adam12> rapha: show your example.
protektwar has quit [Quit: No Ping reply in 180 seconds.]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
<pvalenta> I have another question (maybe stupid) ... I have installed rails by: gem install --user-install rails. Problem is that emacs cannot find rails binary because it's name is actually rails.ruby3.1. I can make symlink manually but after upgrade it will stop working. What could be cause of that weird naming?
<adam12> rapha: i can one line it but it's nasty. initial.each_with_object({}) { |(key, values), obj| values.is_a?(Array) ? values.each_with_index {|v, i| obj[:"#{key}#{i+1}"] = v } : obj[key] = values }
<rapha> o_O
<rapha> alright, that _is_ nasty
<rapha> well, quite long, too
<rapha> and i wouldn't have understood it a year ago but now i do, which feels nice :)
<rapha> seems like this is a good golfing challenge...
<rapha> lazy first improvement: o.each_with_object({}){|(k,v),n|v.is_a?(Array)?(v.size>1?v.each_with_index{|vv,i|n[:"#{k}#{i+1}"]=vv}:v[0]):n[k]=v} ... 116 chars!
* rapha walks over to the fridge to fetch a large trout for hitting everyone with who dares post a 5-bytes version of this using some obscure non-Ruby golfing language
Ziyan_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
michigan has joined #ruby
<adam12> Maybe havenwood will golf it down more. He's the master of Enumerable, imho.
dionysus69 has quit [Ping timeout: 268 seconds]
markong has quit [Ping timeout: 268 seconds]
gr33n7007h has quit [Ping timeout: 268 seconds]
protektwar has quit [Ping timeout: 248 seconds]
typeof[panda] has quit [Quit: Client closed]
FrankD has quit [Read error: Connection reset by peer]
TomyWork has quit [Remote host closed the connection]
Ziyan has joined #ruby
gr33n7007h has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
_ht has quit [Remote host closed the connection]
stylo has joined #ruby
<havenwood> adam12: I'd just reject that `baz` not being `baz1` edge case, since it seems wrong anyways. :P
<adam12> :P
<havenwood> and each.with_object(1)
<havenwood> I mean, each.with_index(1_
<havenwood> each_with_object({}) { |(key, values), obj| Array(values).each.with_index { obj[:"#{key}#{_2}"] = _1 } }
<adam12> Kinda similar to my first approach, until I added the work around for baz1.
<havenwood> adam12: I didn't try from scratch, so I imagine almost identical!
<adam12> Ah yeah.
<havenwood> adam12: Also didn't get that far up in the scrollback, so didn't know you had an initial. :P
<havenwood> But just paired down your one ^ right there
<havenwood> adam12: I have no time or I'd try from scratch. I will later!
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
EdwardIII is now known as edwardiii
FetidToot has joined #ruby
ur5us has joined #ruby
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
terstr has joined #ruby
terstr has quit [Client Quit]
terstr has joined #ruby
terstr has quit [Client Quit]
terstr has joined #ruby
terstr has quit [Client Quit]
terstr has joined #ruby
stdedos has joined #ruby
protektwar has quit [Ping timeout: 260 seconds]
<ox1eef_> that's where the perlisms of ruby probably help.. for golfing.
<ox1eef_> _1, _2, etc look useful for such cases.
<ox1eef_> only to an extent though, my memory tells me they can't nest.
edwardiii is now known as EdwardIII
wand has quit [Ping timeout: 268 seconds]
ua_ has quit [Remote host closed the connection]
wand has joined #ruby
cocalero has joined #ruby
entropie has quit [Quit: ""]
smp has quit [Quit: ZNC 1.8.2 - https://znc.in]
georgemp has quit [Quit: ZNC - https://znc.in]
moldorcoder7 has quit [Quit: %bye mirc%]
Inoperable has quit [Quit: All your buffer are belong to us!]
georgemp has joined #ruby
moldorcoder7 has joined #ruby
smp has joined #ruby
entropie has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
Inoperable has joined #ruby
terstr has quit [Quit: terstr]
stdedos has quit [Quit: stdedos]
stdedos has joined #ruby
stdedos has quit [Remote host closed the connection]
stdedos has joined #ruby
stdedos has quit [Remote host closed the connection]
ua_ has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
cocalero has quit [Quit: Going offline, see ya! (www.adiirc.com)]
bit4bit has quit [Quit: Leaving]
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
michigan has quit [Quit: Connection closed for inactivity]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
markong has joined #ruby
jl- has joined #ruby
<ox1eef_> my take:
<ox1eef_> Hash[x.map { |k,v| [*v].map.with_index(1) { |v1,i| v.size > 1 ? ["#{k}#{i}", v1] : [k.to_s, v1] } }.flatten(1)]
jpn has joined #ruby
<ox1eef_> where x is: {:foo=>["a", "b"], :bar=>["c", "d"], :baz=>"e"}
<ox1eef_> rapha: ^
jpn has quit [Ping timeout: 255 seconds]
<ox1eef_> logical error there, only works by the chance of 'e' being size of 1... fix:
<ox1eef_> Hash[x.map { |k,v| [*v].map.with_index(1) { |v1,i| [*v].size > 1 ? ["#{k}#{i}", v1] : [k.to_s, v1] } }.flatten(1)]
stylo has quit [Quit: Connection closed for inactivity]
wand has quit [Remote host closed the connection]
wand has joined #ruby
<ox1eef_> golf'ed: x.map{|k,v|[*v].map.with_index(1){|v1,i|[*v].size>1?["#{k}#{i}",v1]:[k.to_s,v1]}}.flatten(1).to_h
<ox1eef_> 97 chrs