havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.0, 2.7.2, 2.6.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3
<ve^ue> ?fact cargo_cult
<ruby[bot]> ve^ue: I don't see no cargo_cult, whom should I tell about fact?
darthThorik has quit [Ping timeout: 252 seconds]
MalkbabY has joined #ruby
hiroaki has quit [Ping timeout: 246 seconds]
darthThorik has joined #ruby
DaRock has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
ve^ue is now known as venue
DaRock has joined #ruby
venue has quit [Quit: venue]
crankharder has joined #ruby
Rounin has quit [Quit: Rounin]
crankharder has quit [Ping timeout: 260 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cuerbot has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
hiroaki has joined #ruby
ur5us has joined #ruby
hiroaki has quit [Ping timeout: 246 seconds]
dka has joined #ruby
brunosaboia__ has joined #ruby
brunosaboia__ has quit [Quit: This computer has gone to sleep]
patr0clus has joined #ruby
patr0clus has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
Technodrome has joined #ruby
CrazyEddy has quit [Remote host closed the connection]
feminine has joined #ruby
crankharder has joined #ruby
feminine has quit [Changing host]
feminine has joined #ruby
crankharder has quit [Ping timeout: 265 seconds]
Azure|dc has quit [Read error: Connection reset by peer]
Azure has joined #ruby
patr0clus has joined #ruby
<LACampbell> where is the block syntax described? ie stuff like `numbers.map(&:to_i)`
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
<havenwood> LACampbell: :to_i is just a Symbol, so it's the ampersand that's special syntax.
<havenwood> LACampbell: It does two things. First, it calls #to_proc, so :to_i.to_proc.
<havenwood> LACampbell: Second, it passes the result as a block.
<havenwood> &>> :to_i.to_proc.call '42'
<rubydoc> # => 42 (https://carc.in/#/r/apgd)
<havenwood> &>> ['42'].map(&:to_i)
<rubydoc> # => [42] (https://carc.in/#/r/apge)
patr0clus has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
Vingador has joined #ruby
patr0clus has joined #ruby
pwnd_ has quit [Quit: Ping timeout (120 seconds)]
pwnd_ has joined #ruby
gix- has joined #ruby
gix has quit [Disconnected by services]
venue has joined #ruby
<LACampbell> TIL that a method was an object that had a to_proc method
<LACampbell> no that's not right
<LACampbell> a symbol has a to_proc method
<LACampbell> is it at all possible to convert `SomeObject.someMethod` to a proc?
jenrzzz has joined #ruby
venue has quit [Quit: venue]
neshpion has quit [Quit: neshpion]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 265 seconds]
duderonomy has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
duderonomy has joined #ruby
dinfuehr has quit [Ping timeout: 252 seconds]
m27frogy has quit [Ping timeout: 252 seconds]
dinfuehr has joined #ruby
ur5us has quit [Ping timeout: 258 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
ChmEarl has quit [Quit: Leaving]
Technodrome has joined #ruby
crankharder has joined #ruby
<LACampbell> oh there's a .method for that, nice
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
ImARealDoctor has joined #ruby
<ImARealDoctor> Would somebody mind generating a fresh Rails 6.1.3.1 app, install Webpacker 6.0.0.pre.2, and see if a simple `console.log` works out of the box?
<ImARealDoctor> I just need to confirm that it's me and not Rails/Webpacker themselves there's something wrong with.
explorier has quit [Remote host closed the connection]
explorier has joined #ruby
jenrzzz has joined #ruby
Vingador has quit [Ping timeout: 240 seconds]
patr0clus has quit [Quit: Textual IRC Client: www.textualapp.com]
jenrzzz has quit [Ping timeout: 240 seconds]
konsolebox has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
explorier has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
niv has quit [Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net]
niv has joined #ruby
niv has quit [Client Quit]
niv has joined #ruby
niv has quit [Client Quit]
niv has joined #ruby
niv has quit [Client Quit]
jenrzzz has joined #ruby
niv has joined #ruby
niv has quit [Read error: Connection reset by peer]
Xiti has quit [Quit: Leaving]
explorier has joined #ruby
explorier has quit [Ping timeout: 268 seconds]
Xiti has joined #ruby
crankharder has joined #ruby
nixue has quit [Quit: Connection closed]
crankharder has quit [Ping timeout: 252 seconds]
niv has joined #ruby
jenrzzz has quit [Remote host closed the connection]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
lockweel has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
thewrinklyninja has joined #ruby
ljarvis has quit [Quit: Lost terminal]
MalkbabY has quit [Remote host closed the connection]
hiroaki has joined #ruby
MalkbabY has joined #ruby
akem has quit [Ping timeout: 265 seconds]
Rounin has joined #ruby
akem has joined #ruby
keden has joined #ruby
gearnode has joined #ruby
TomyWork has joined #ruby
jla has joined #ruby
thewrinklyninja has quit [Quit: Leaving]
hiroaki1 has quit [Ping timeout: 258 seconds]
gix- has quit [Ping timeout: 252 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
<keden> Hello! I'd like to know what people think about net/http vs Faraday vs HTTParty for an API wrapper gem. I'm tempted to go with net/http to have very few dependencies, but do you think this would be a mistake?
crankharder has quit [Ping timeout: 260 seconds]
Technodrome has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 246 seconds]
postmodern has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
al2o3-cr has joined #ruby
* nakilon started building own wrapper before all those fancy gems became popular -- in 2014, and uses it since then
<nakilon> the only downside you'll have is that it won't be as optimized for modern HTTP standards as some popular gems, like the number of network connections, etc.
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has joined #ruby
NL3limin4t0r_ark is now known as NL3limin4t0r
crankharder has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
Technodrome has joined #ruby
TCZ has joined #ruby
^jud has joined #ruby
jud^ has quit [Ping timeout: 268 seconds]
^jud has quit [Client Quit]
<NL3limin4t0r> ImARealDoctor: It works fine for me. I created a Rails 6.1.3.1 app, updated webpacker to 6.0.0.pre.2. Added `console.log("Hello World!")` in app/javascript/packs/application.rb, added the route `root to: 'dashboard#home'`, created the app/controllers/dashboard_controller.rb controller with an empty #home method and added an empty app/views/dashboard/home.html.erb view.
<NL3limin4t0r> Note that the default home screen "Yay! You're on Rails!" does not use the application layout and therefor does not load your application pack.
<TCZ> yay
m27frogy has joined #ruby
<NL3limin4t0r> ImARealDoctor: Ah, I hadn't seen you also posted the question in #RubyOnRails, let's move the conversation there if you want to respond.
akem_ has quit [Ping timeout: 240 seconds]
<nakilon> few days ago someone said he wants Array#split
<nakilon> I think that's kinda what Array#chunk is doing
BSaboia has joined #ruby
wallacer has quit [Ping timeout: 250 seconds]
LtHummus has quit [Ping timeout: 260 seconds]
akem has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
<nakilon> hmmmm, I don't like that String#delete_prefix does not mutate the string
<nakilon> it's inconsistent with Array#delete
BSaboia has joined #ruby
crankharder has joined #ruby
Jonopoly has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
MalkbabY has quit [Remote host closed the connection]
jla has quit [Ping timeout: 252 seconds]
MalkbabY has joined #ruby
wallacer has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
crankharder has joined #ruby
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby
LtHummus has joined #ruby
cd has quit [Quit: cd]
konsolebox has joined #ruby
TCZ has quit [Quit: Czesc]
BTRE has quit [Remote host closed the connection]
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
Jonopoly has quit [Quit: WeeChat 3.0.1]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has quit [Ping timeout: 252 seconds]
crankharder has joined #ruby
akem has quit [Ping timeout: 268 seconds]
akem has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
TCZ has joined #ruby
ChmEarl has joined #ruby
crankharder has joined #ruby
Rudd0 has quit [Read error: Connection reset by peer]
jimms has joined #ruby
BTRE has joined #ruby
feminine has quit [Quit: Reconnecting]
akem has quit [Quit: leaving]
brigitte has joined #ruby
aloy has quit [Ping timeout: 240 seconds]
akem has joined #ruby
<nakilon> &. is cancer
<rubydoc> nakilon: parser error ["Expected \">>\", but got ", ". "@0] at position 0 around `.'
<nakilon> see? even bot got problems
Mrgoose has quit [Ping timeout: 260 seconds]
<nakilon> it's one of a penty of bad influences that Ruby has got from Web; basically Web is built in the way to pretend it's working; it's in the core of Web -- to show an end user anything just to keep him on the webpage even if data on it is invalid
brigitte is now known as aloy
<nakilon> like here the forum has a bug -- it does not close the <i> tag, but the browsers are built in the way to supress this error: https://i.imgur.com/YnNv57y.png
<nakilon> and the &. method introduced in Ruby 2.3 is aiming the same goal -- hide the errors, supress them, and don't give a damn
konsolebox has quit [Ping timeout: 268 seconds]
<havenwood> nakilon: You sound like an XHTML evangelist. :P
<havenwood> If the web's problem was just nils, that's a lovely thought.
<havenwood> More came from Scala. ;P
<nakilon> if I have a problem (and lots of people who did the same a few times in their life) parsing the website because the "closing tag" problem was supressed in browsers, imagine how many bugs are hidden in any Ruby code that is written using the &.
<havenwood> I'm not knocking XHTML. I validate for fun.
<havenwood> I was kinda sad the web didn't tighten up a bit.
<havenwood> The HTML path works fine, but inconsistencies are still a pain.
<keden> nakilon: yeah that's one of my concerns, but then I saw that Twilio and Stripe are just using 'net/http' for instance, which kinda comforted me in my preference.
<keden> ?keden
<ruby[bot]> keden: I don't know anything about keden
<keden> meh, sorry
<nakilon> ?havenwood
<ruby[bot]> nakilon: I don't know anything about havenwood
<havenwood> I think "havenwood" is an old folks' home down by the lake.
<adam12> O_O
<havenwood> Sounds like a retirement home name.
<nakilon> automatic closing tags fix is a problem close to be unsolvable -- I'll have to copypaste the bug into my parser to just support parsing this single page
<nakilon> or edit the page in crawling cache manually that is nearly the same stupid
<havenwood> keden: Net::HTTP gets a bit shinier with the new scheduler and Async making concurrency easy. Things using libcurl like Typhoeus almost seem more conservative.
cliluw has quit [Ping timeout: 252 seconds]
Technodrome has joined #ruby
<adam12> Although I do enjoy a healthy ecosystem, seeing a half-dozen HTTP libraries in a Gemfile.lock does induce some sadness.
<adam12> havenwood: Reminds me of one of those short-lived TV shows that has all the cliche moments. Borderline Hallmark.
<nakilon> adam12 replace them with a single own one )
<adam12> nakilon: Hard when it’s dependencies of dependencies. For a while, everyone just standardized on Faraday which was nice.
konsolebox has joined #ruby
<havenwood> adam12: Tonight, on "havenwood," Laura protects the farm from invading badgers.
* adam12 chuckles
<nakilon> IIRC faraday had compilation error
<nakilon> s
<keden> I think I'll simply go with Net::HTTP and see how I get on.
<adam12> keden: Faraday by default wraps Net::HTTP, but also offers other adapters.
<nakilon> keden which HTTP methods do you need? if only GET you might use open-uri
<adam12> keden: Nothing wrong with going with Net:HTTP tho. I’m fairly sure Stripe’s Ruby SDK started with Faraday and then went back to plain Net::HTTP.
<keden> adam12: GET and POSR
<keden> adam12: That's rights, they made the switch here: https://github.com/stripe/stripe-ruby/pull/813/files
<FetidToot> +1 for faraday. i only use net:http when i'm building a script or something for others where i don't want them to have to deal with dependencies.
akem has quit [Quit: bbl]
<havenwood> httpx is a nifty one
<havenwood> keden: Square uses Faraday too. It can be nice for SDKs to help align on whatever adapter folk want to use.
<havenwood> keden: FWIW, here's a spreadsheet of Ruby HTTP clients and features https://docs.google.com/spreadsheets/d/1vPlk6nMIFa3sI5ISl7zZ5r6lDNpVQX6Jxi3ksXCyVbs/edit?usp=sharing
<havenwood> HTTP/2 support with good multiplexing is starting to be a differtiator.
<havenwood> Only the libcurl wrappers Typhoeus and Curb and pure Ruby async-http and httpx support HTTP/2, afaik.
<havenwood> ah, yeah, there's NetHttp2, but I haven't added it to the sheet yet https://github.com/ostinelli/net-http2
ua has quit [Ping timeout: 240 seconds]
Mrgoose has joined #ruby
akem has joined #ruby
akem has quit [Client Quit]
akem has joined #ruby
wallacer has quit [Ping timeout: 250 seconds]
akem has quit [Client Quit]
akem has joined #ruby
<MalkbabY> Matz should announce the sale of Ruby to Microsoft next year :P
<MalkbabY> That might hit a bit too close to home though, lol
<keden> havenwood: Thanks a lot for sharing, that's super helpful. HTTPX does sound good actually, but then if I do go for a dependency, I might as well use Faraday.
Nowaker has quit [Quit: No Ping reply in 180 seconds.]
Nowaker has joined #ruby
wallacer has joined #ruby
ua has joined #ruby
deviantfero has joined #ruby
deviantfero has quit [Client Quit]
robotmay has quit [Quit: Be excellent to each other]
<Rounin> R.Net as I like to call it
Nowaker has quit [Remote host closed the connection]
robotmay has joined #ruby
Nowaker has joined #ruby
<MalkbabY> R.NET, the new official programming language of the Clippers, GitHub and Pepsi.
<Rounin> Hmm... Microsoft as a leading open source company... The cognitive dissonance hasn't quite worn off
mniip has quit [Ping timeout: 608 seconds]
jla has joined #ruby
venue has joined #ruby
Mrgoose has quit [Ping timeout: 268 seconds]
jetchisel has joined #ruby
Lyubo1 has quit [Ping timeout: 240 seconds]
Lyubo1 has joined #ruby
DTZUZU_ has joined #ruby
DTZUZU has quit [Ping timeout: 268 seconds]
crankharder has quit [Ping timeout: 246 seconds]
havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Python 3.0.0, 2.7.2, 2.6.6: https://www.python.org/ | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3
samp has joined #ruby
<samp> test
crankharder has joined #ruby
<NL3limin4t0r> samp: 👍
<samp> nice
<havenwood> Ooh, what do you all think of the new fourquals operator for pattern matching? I'm not sure I like ====, just visually...
<adam12> The more equals, the more it matches. havenwood ======== [dna_sequence]
DTZUZU has joined #ruby
<samp> havenwood, i think we need a corrosponding `!=!=` operator
DTZUZU_ has quit [Ping timeout: 265 seconds]
<havenwood> samp: and !===
<havenwood> wait, !====?
<havenwood> I dunno
<havenwood> Fourquals is still new to me.
<havenwood> adam12: good idea, a more perfect match approaches infinite equals
<samp> petition to rename it forqals
<havenwood> true, shorter
<samp> forquals *
<havenwood> or maybe frqls
<havenwood> vowels? meh.
<samp> 4=s
<havenwood> f7s
<samp> oh i havea n idea
<samp> `==~`
<samp> remove `===`, make it `==~`
<samp> or `~=~`
<nakilon> (💎=💎)
Nowaker has quit [Ping timeout: 252 seconds]
Nowaker has joined #ruby
Mrgoose has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
Rudd0 has joined #ruby
bvdw has joined #ruby
Technodrome has joined #ruby
Rounin has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 240 seconds]
TCZ has quit [Quit: Dowidzenia]
tpanarch1st has joined #ruby
venue has quit [Remote host closed the connection]
duderonomy has quit [Ping timeout: 268 seconds]
duderonomy has joined #ruby
cthulchu has joined #ruby
duderonomy has quit [Ping timeout: 268 seconds]
crankharder has joined #ruby
Exuma has joined #ruby
Exuma has quit [Client Quit]
tpanarch1st has quit [Ping timeout: 265 seconds]
TomyWork has quit [Quit: Leaving]
crankharder has quit [Ping timeout: 246 seconds]
howdoi has joined #ruby
Nowaker has quit [Ping timeout: 265 seconds]
crankharder has joined #ruby
Nowaker has joined #ruby
jdeen has joined #ruby
jimms has quit [Quit: Leaving]
neshpion has joined #ruby
samp has quit [Quit: Connection closed]
roshanavand has joined #ruby
shtirlic has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
Nowaker has quit [Ping timeout: 240 seconds]
Nowaker has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderono_ has joined #ruby
deviantfero has joined #ruby
duderonomy has quit [Ping timeout: 252 seconds]
tpanarch1st has joined #ruby
nertzy__ has quit [Quit: Leaving]
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
nertzy has joined #ruby
nertzy has quit [Client Quit]
nertzy has joined #ruby
explorier has joined #ruby
roshanavand has quit [Ping timeout: 268 seconds]
roshanavand has joined #ruby
TrufflePump has quit [Ping timeout: 252 seconds]
jdeen has joined #ruby
BSaboia has joined #ruby
tpanarch1st has quit [Ping timeout: 260 seconds]
Rounin has joined #ruby
gix has joined #ruby
TrufflePump has joined #ruby
DTZUZU_ has joined #ruby
TrufflePump has quit [Ping timeout: 268 seconds]
DTZUZU has quit [Ping timeout: 240 seconds]
Nowaker has quit [Ping timeout: 260 seconds]
Nowaker has joined #ruby
explorier has quit [Ping timeout: 265 seconds]
shtirlic has joined #ruby
Technodrome has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
explorier has joined #ruby
jdeen has quit [Quit: Textual IRC Client: www.textualapp.com]
bamdad has quit [Remote host closed the connection]
bamdad has joined #ruby
bamdad has quit [Remote host closed the connection]
roshanavand_ has joined #ruby
bamdad has joined #ruby
patr0clus has joined #ruby
roshanavand has quit [Ping timeout: 246 seconds]
vondruch has quit [Read error: Connection reset by peer]
hiroaki has quit [Ping timeout: 246 seconds]
robotbee has joined #ruby
cd has joined #ruby
hiroaki has joined #ruby
TrufflePump has joined #ruby
TrufflePump has quit [Ping timeout: 240 seconds]
jinie_ has quit [Quit: ZNC 1.8.2 - https://znc.in]
jinie has joined #ruby
patr0clus has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
duckpuppy has quit [Ping timeout: 260 seconds]
duckpuppy has joined #ruby
shortdudey123_ has quit [Ping timeout: 246 seconds]
shortdudey123 has joined #ruby
DaRock has quit [Ping timeout: 268 seconds]
shortdudey123 has quit [Excess Flood]
DaRock has joined #ruby
mniip has joined #ruby
shortdudey123 has joined #ruby
shortdudey123 has quit [Excess Flood]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AndreYuhai has joined #ruby
<AndreYuhai> Hey there, why do I need to explicitly use self here: https://ghostbin.co/paste/c96r7xj
<AndreYuhai> I mean self.user_agent_alias = ... Otherwise user_agent doesn't change
shortdudey123 has joined #ruby
shortdudey123 has quit [Excess Flood]
<NL3limin4t0r> AndreYuhai: Without `self` you create a local variable `user_agent_alias`, with `self` you call the `user_agent_alias=` method on the current instance.
<AndreYuhai> NL3limin4t0r, Ooooh, I always do that. Now I remember
<AndreYuhai> Thank you for reminding me that. I just have the idea of the methods like user_agent_alias= so I expect them to work without self as well but of course I forget that I am creating a variable without the self. :D
<NL3limin4t0r> It's basically ambiguous syntax so the smalles scope is used.
CrazyEddy has joined #ruby
<AndreYuhai> Alright, thank you so much. I will probably forget that and ask it again as well. :D Because I just remembered after your answer that I'd already asked something similar before. :D
<phaul> this use case of self is probably what
<phaul> 's motivated the self allowed to receive private method change
<NL3limin4t0r> You could also do it without self.
<NL3limin4t0r> But it isn't pretty
<NL3limin4t0r> If you use parentheses Ruby knows it's a method and implicitly calls it upon self.
shortdudey123 has joined #ruby
<NL3limin4t0r> eg. `user_agent_alias=(AGENT_ALIASES.keys.sample)`
<NL3limin4t0r> If I'm not mistaken
MalkbabY has quit [Remote host closed the connection]
<NL3limin4t0r> But there can't be any spaces around the `=` there, otherwise it's a variable assignment again.
shortdudey123 has quit [Excess Flood]
<NL3limin4t0r> But I'm not entirely sure
MalkbabY has joined #ruby
<AndreYuhai> NL3limin4t0r, That doesn't seem to work
<AndreYuhai> phaul, I didn't get what you mean, sorry.
<NL3limin4t0r> K, never mind that than.
<phaul> I pointed out something not quite relevant here, so don't worry about it too much
<NL3limin4t0r> you can use it to differntiate between a read from local variables or method, but guess not for assignment
<phaul> if foo was a private method on self, self.foo used to fail - now it's allowed
<phaul> so you don't have the issue with private attr_writers
<NL3limin4t0r> say you have a variable `foo` and a private method `foo` you can still distinguish them using `foo` and `foo()` but `self.foo` is more descriptive imo
shortdudey123 has joined #ruby
al2o3-cr has quit [Read error: Connection reset by peer]
<phaul> right, emphasis was on this motivated the change, not that it's the only way of doing it
<AndreYuhai> phaul, so if you use self.foo is ok but if you try to use it from an instance then you get the error
Technodrome has joined #ruby
<AndreYuhai> Oh I get it
al2o3-cr has joined #ruby
<phaul> &20>> class X; def f; self.w = 1; end; private attr_writer :w; end; X.new.f
<rubydoc> # => -e:4:in `private': nil is not a symbol (TypeError)... check link for more (https://carc.in/#/r/appz)
kinduff has quit [Quit: Ping timeout (120 seconds)]
kinduff has joined #ruby
<phaul> idk. this isn't what I tried to demonstrate
<phaul> &20>> class X; def f; self.w = 1; end; private; attr_writer :w; end; X.new.f
<rubydoc> # => 1 (https://carc.in/#/r/apq3)
<phaul> hm. did I imagine that we couldn't use private with any explicit receiver including self? what's going on here?
<havenwood> AndreYuhai: Instead, you can assign instance variables.
Nowaker has quit [Ping timeout: 240 seconds]
crankharder has quit [Ping timeout: 268 seconds]
Nowaker has joined #ruby
explorier has quit [Ping timeout: 240 seconds]
<AndreYuhai> havenwood, instead of what?
<havenwood> AndreYuhai: Instead of assigner methods.
<havenwood> Setter methods*
<AndreYuhai> havenwood, how would I do that in this case? I didn't really get it, sorry.
<havenwood> AndreYuhai: So `@foo = 42` instead of `self.foo = 42`.
<havenwood> It's faster and conveys the simplicity of the operation to the reader.
shortdudey123 has quit [Ping timeout: 268 seconds]
<havenwood> A `@foo = 42` cannot do other things. A `self.foo = 42` does gods know what.
<havenwood> It might not even set @foo.
explorier has joined #ruby
<AndreYuhai> havenwood, But I am inheriting from Mechanize, so how can I do that in this case?
<NL3limin4t0r> phaul: `private attr_writer :w` does not work like you expect. `attr_writer` returns `nil`. So you first create a public attribute writer with `attr_writer :w` this returns `nil` which you pass to `private`, so `private nil`
<NL3limin4t0r> you'll have to do that in two statements
<phaul> yeah, and I also was wrong about the change, I misremembered it
<havenwood> AndreYuhai: Sec, lemme look at mechanize and see what the method does. I may have assumed incorreclty.
<NL3limin4t0r> `attr_writer :w` then `private :w=`
<havenwood> AndreYuhai: I didn't scroll back far enough initially.
explorier has quit [Ping timeout: 240 seconds]
<phaul> NL3limin4t0r: this is what I was referring to https://bugs.ruby-lang.org/issues/16123 but I thought before even setters didn't work. Mea culpa
<havenwood> AndreYuhai: Okay, so looking at implementation, you'd have to: @user_agent = AGENT_ALIASES.keys.sample
<havenwood> AndreYuhai: The setter method does: self.user_agent = AGENT_ALIASES[name]
<AndreYuhai> havenwood, oh then it will probably be AGENT_ALIASES.values now
<AndreYuhai> since we are directly setting it
<havenwood> AndreYuhai: Often worth checking on underlying implementation of methods, especially if that implementation is in Ruby. :)
<havenwood> AndreYuhai: Gah, but #user_agent= isn't the instance variable either. Hah.
<havenwood> AndreYuhai: It's: @agent.user_agent = user_agent
<NL3limin4t0r> &20>> singleton_class.private def foo=(value); @foo = value; end; self.foo = 20
<AndreYuhai> havenwood, it's @agent.user_agent
<rubydoc> # => -e:4:in `<main>': private method `private' called for #<Class:#<Object:0x00000000e4e468>> (NoMethodError)... check link for more (https://carc.in/#/r/apqh)
<havenwood> AndreYuhai: Yup.
<NL3limin4t0r> phaul: ^ that is what you are looking for I guess
<havenwood> AndreYuhai: Good point on values.
<havenwood> AndreYuhai: @agent.user_agent = AGENT_ALIASES.values.sample
<AndreYuhai> Thank you for the help! :)
<havenwood> AndreYuhai: Now more direct and faster. :)
<havenwood> Any time!
<AndreYuhai> Yes, that looks better.
<havenwood> Downside would be that you could say this is a private interface. More clear to do it in your own code. This is probably fairly stable anyways.
Tempesta has quit [Quit: See ya!]
<havenwood> When you open a class, it becomes your own code. :P
<jla> say i'm on rvm ... ruby 2.7.2 and did ^^ '$ gem install decidim' as per docs ...
NL3limin4t0r is now known as NL3limin4t0r_afk
<jla> now i realize that i may have switched to (currently already available on my system) ruby 3.0 ... does it metter if i switch ruby versions before or afeter the given Gem install ?
<phaul> yeah, depending on the task at hand, it might be better not to inherit from Mechanize in the first place. If one wants to extend the functionality one could have a Mechanize instance internally and delegate methods to it. That way it's only the public API that 's been used
<havenwood> jla: The gem would only be available in Ruby 2.7.
<havenwood> jla: You can install it for both Rubies if you'd like.
<jla> ah ... i have both
Tempesta has joined #ruby
<jla> yet, i've seen that i may have switched to v3.0 prio to ... ok, i see
<havenwood> jla: You can install for all Rubies: rvm all do gem install decidim
<jla> ah
<havenwood> jla: Or pick those you'd like: rvm 2.7.2,3.0.0 do gem install decidim
<jla> they are hundreds of ...
<havenwood> jla: All the Rubies you have installed...
<jla> nice to know
<havenwood> Not all possible Rubies.
<nakilon> has anyone deployed to Google Cloud Functions?
<AndreYuhai> So is it better to have a Mechanize instance instead of inheriting?
<havenwood> AndreYuhai: Yes, generally.
<phaul> If you don't own the code you shouldn't really inherit from it
<AndreYuhai> Usually I was creating an instance but then inheriting feels like easier.
<nakilon> I get this error when deploying the function: https://dpaste.org/p0J0/slim
<AndreYuhai> phaul, oh alright, I will keep that in mind and try to use an instance now.
robotbee has quit [Ping timeout: 265 seconds]
<nakilon> I would suppose it's because the us.gcr.io/fn-img/buildpacks/ruby26/builder:ruby26_20210322_2_6_6_RC00 does not have git installed but I'm not sure the error message means exactly that
explorier has joined #ruby
banisterfiend has quit [Changing host]
banisterfiend has joined #ruby
crankharder has joined #ruby
explorier has quit [Ping timeout: 246 seconds]
crankharder has quit [Ping timeout: 265 seconds]
deviantfero has quit [Quit: WeeChat 3.1]
explorier has joined #ruby
explorier has quit [Ping timeout: 240 seconds]
<nakilon> I ran "bundle install --deployment", "mv vendor/bundle/ruby/2.5.0/bundler/gems/damerau-levenshtein-c009e42913bc/ ./", changed "github" to "path" in Gemfile -- hope it will work now
<nakilon> FFFUUUU: LoadError: libruby.so.2.5: cannot open shared object file: No such file or directory - /workspace/damerau-levenshtein-c009e42913bc/lib/damerau-levenshtein/damerau_levenshtein.so
explorier has joined #ruby
explorier has quit [Ping timeout: 240 seconds]
shortdudey123 has joined #ruby
explorier has joined #ruby
ur5us has joined #ruby
crankharder has joined #ruby
shortdudey123 has quit [Ping timeout: 268 seconds]
crankharder has quit [Ping timeout: 240 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cthu| has joined #ruby
lockwell has joined #ruby
jla has quit [Ping timeout: 265 seconds]
cthulchu has quit [Ping timeout: 240 seconds]
MalkbabY_ has joined #ruby
lockweel has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 258 seconds]
cthulchu_ has joined #ruby
genpaku has quit [Ping timeout: 246 seconds]
lockwell has quit [Client Quit]
genpaku has joined #ruby
lockweel has joined #ruby
MalkbabY has quit [Ping timeout: 240 seconds]
cthu| has quit [Ping timeout: 260 seconds]
lockweel has quit [Client Quit]
Mia has quit [Write error: Connection reset by peer]
<nakilon> ok, guy from Google responded quickly, though it does not look there is a solution
<nakilon> they didn't test it on Gemfiles with :github
Mia has joined #ruby
Mia has joined #ruby
alexherbo2 has joined #ruby
alexherbo2 has quit [Remote host closed the connection]
cliluw has joined #ruby
explorier has quit [Ping timeout: 240 seconds]
Axy has joined #ruby
Axy has quit [Changing host]
Axy has joined #ruby
explorier has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Mia has quit [Ping timeout: 240 seconds]
GodFather has joined #ruby
explorier has quit [Ping timeout: 240 seconds]
patr0clus has joined #ruby
explorier has joined #ruby
duderono_ has quit [Quit: Textual IRC Client: www.textualapp.com]
explorier has quit [Ping timeout: 240 seconds]
explorier has joined #ruby
cthu| has joined #ruby
Mia has joined #ruby
cthulchu_ has quit [Ping timeout: 240 seconds]
Axy has quit [Ping timeout: 240 seconds]
<nakilon> okay, I decided I don't actually need to deploy the github fork and rubygems version is fine; the Function works, yay! runs out of 256MB of RAM though, needs some optimization (
Technodrome has joined #ruby
robotbee has joined #ruby
patr0clus has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
shortdudey123 has joined #ruby
oneeggeach has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
Mrgoose has quit [Quit: The Lounge - https://thelounge.chat]
gearnode has quit [Ping timeout: 246 seconds]
cthu| has quit [Ping timeout: 268 seconds]