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!
blackmesa has quit [Ping timeout: 240 seconds]
LtHummus has quit [Quit: ZNC 1.7.5 - https://znc.in]
LtHummus has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Garb0 has joined #ruby
romanlevin has quit [Ping timeout: 272 seconds]
d3bug has joined #ruby
dandaman has joined #ruby
orbyt_ has joined #ruby
<dandaman> hi all. I have a class function that returns an object of the instance but with some added keys… I'm not sure how to do this with ruby though. Can someone take a look at this gist and let me know what the proper syntax should be? https://gist.github.com/dsauerbrun/5dfc7d122182f23872cd2865de3b31a3
<dandaman> do i just need to do my_ret_val = {} and just map all of the class properties? that seems tedious :(
<havenwood> dandaman: I don't follow your example.
<havenwood> dandaman: self.respond_to?(:[]=)
<havenwood> dandaman: So you're saying #[]= is defined or what are you getting at here?
<havenwood> dandaman: Say what you want to do another way? Or say why? Or show real code?
<dandaman> ok, i'll show the real code, one moment
inanepenguin has quit [Quit: inanepenguin]
<dandaman> havenwood: line 142 of new.rb is what i'm trying to do https://gist.github.com/dsauerbrun/5dfc7d122182f23872cd2865de3b31a3
<dandaman> compare to how i'm doing it in the method in line 142 of old.rb
<dandaman> basically i'm sending a json friendly version of the object to an endpoint, but there are some properties I want to send along with that object for the endpoint such as grades, accommodations, etc… which are related datum
<havenwood> dandaman: attributes.symbolize_keys.slice(*keys)
<havenwood> dandaman: For example: Location.create.attributes.symbolize_keys.slice(*keys)
<dandaman> kk, lemme try it
<havenwood> dandaman: `keys` being an Array of the Symbols keys.
<dandaman> is there an easy way to get a list of the keys of a class?
SeepingN has quit [Ping timeout: 256 seconds]
<dandaman> hmm i tried json_return = self.attributes.symbolize_keys.slice(['id', 'name']) and it didnt work :\
<dandaman> json_return = self.attributes.symbolize_keys.slice(['id', 'name'])
<dandaman> json_return[:accommodations] = self.get_accommodations
<dandaman> return json_return
<dandaman> the only thing that was returned was the accommodations property
<dandaman> damn… i've gotta run now though, to be continued :(
<leftylink> &>> h = {a: 5}; [h.slice([:a]), h.slice(:a)]
<leftylink> big difference.
<rubydoc> # => [{}, {:a=>5}] (https://carc.in/#/r/919a)
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dandaman> thank you leftylink
drincruz has joined #ruby
ChmEarl has quit [Quit: Leaving]
ChmEarl has joined #ruby
monter has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
dandaman has quit [Quit: Leaving.]
cliluw has quit [Ping timeout: 264 seconds]
monter has quit [Quit: This computer has gone to sleep]
mikecmpbll has quit [Quit: inabit. zz.]
cnsvc has joined #ruby
cliluw has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
monter has joined #ruby
DTZUZU has quit [Quit: WeeChat 2.7]
schne1der has quit [Ping timeout: 246 seconds]
monter has quit [Quit: Leaving]
monter76 has joined #ruby
Vashy has quit [Ping timeout: 252 seconds]
cnsvc has joined #ruby
Vashy has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
<monter76> Hi. I'd like to view the all the old messages on the server to see some cool ruby snippets and such. I'm not sure how to do this, I'm new to IRC. Are the logs for this channel, or for free node channels in general, stored anywhere? I checked https://freenode.logbot.info/?q=ruby and https://echelog.com/
drincruz has quit [Ping timeout: 246 seconds]
<adam12> monter76: I don't believe this channel is logged.
<adam12> monter76: I stand corrected. https://freenode.irclog.whitequark.org/ruby/2020-05-09
cnsvc has joined #ruby
<monter76> Thanks adam12, you're the man.
monter76 has quit [Remote host closed the connection]
Garb0 has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
<havenwood> I can't search the logs for my posts. Gateway timeout. Haha.
<havenwood> I'd have thought the `nick:nick_here` format would be faster than the just `nick_here`.
chouhoulis has quit [Remote host closed the connection]
stnly has quit [Quit: goodbye]
<havenwood> I guess they're both timing out.
<havenwood> Server is probably at dinner.
stnly has joined #ruby
stnly has quit [Client Quit]
stnly has joined #ruby
ChmEarl has quit [Quit: Leaving]
sergioro has quit [Quit: Lost terminal]
stnly has quit [Quit: goodbye]
stnly has joined #ruby
SanguineAnomaly has quit [Ping timeout: 260 seconds]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
Technodrome has quit [Remote host closed the connection]
donofrio has joined #ruby
Garb0 has quit [Quit: Leaving]
gix has quit [Disconnected by services]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
michael_mbp has quit [Ping timeout: 260 seconds]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
cnsvc has quit [Ping timeout: 240 seconds]
michael_mbp has joined #ruby
jetchisel has joined #ruby
DTZUZU has joined #ruby
inguz has joined #ruby
wymillerlinux has quit [Ping timeout: 260 seconds]
sergioro has joined #ruby
cnsvc has joined #ruby
blackmesa has joined #ruby
sauvin has joined #ruby
inguz has quit [Quit: I am functioning within established parameters.]
cnsvc_ has joined #ruby
wilhelm418 has quit [Ping timeout: 256 seconds]
imode has quit [Ping timeout: 256 seconds]
cnsvc_ has quit [Ping timeout: 240 seconds]
cnsvc_ has joined #ruby
jeromelanteri has quit [Ping timeout: 246 seconds]
wilhelm418 has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc_ has quit [Quit: WeeChat 2.8]
renich has quit [Quit: renich]
ldepandis has joined #ruby
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
tubbo has joined #ruby
sergioro has quit [Quit: Lost terminal]
cnsvc has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
gix has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.8]
al2o3-cr has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
livcd has joined #ruby
cnsvc has joined #ruby
cliluw has quit [Ping timeout: 256 seconds]
jetchisel has quit [Ping timeout: 246 seconds]
jetchisel has joined #ruby
jetchisel has quit [Max SendQ exceeded]
jetchisel has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
xco has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
jetchisel has quit [Ping timeout: 256 seconds]
blackmesa has joined #ruby
cliluw has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
Garb0 has joined #ruby
Garb0 has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
Garb0 has quit [Quit: Leaving]
Garb0 has joined #ruby
buckworst has joined #ruby
SanguineAnomaly has joined #ruby
<xco> havenwood what's the link with which you view IRC history? I think you posted it to me once :)
<phaul> xco it's in the topic
buckworst has quit [Quit: WeeChat 2.8]
blackmesa has joined #ruby
Garb0 has quit [Read error: Connection reset by peer]
jetchisel has joined #ruby
<xco> phaul thanks :) is there a similar thing for #rubyonrails?
<phaul> idk
<xco> 👌🏾
wilhelm418 has quit [Ping timeout: 256 seconds]
chalkmonster has joined #ruby
caterfxo has quit [Ping timeout: 272 seconds]
ellcs has joined #ruby
Garb0 has joined #ruby
cnsvc has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
markopasha has joined #ruby
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 252 seconds]
markopasha has quit [Client Quit]
markopasha has joined #ruby
markopasha has quit [Client Quit]
markopasha has joined #ruby
dionysus69 has joined #ruby
markopasha has quit [Client Quit]
blackmesa1 has quit [Ping timeout: 244 seconds]
schne1der has joined #ruby
gitter1234 has joined #ruby
drincruz has joined #ruby
caterfxo has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
kinduff5 has joined #ruby
kinduff has quit [Ping timeout: 260 seconds]
kinduff5 is now known as kinduff
troulouliou_dev has joined #ruby
cnsvc has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
SanguineAnomaly has quit [Ping timeout: 246 seconds]
cnsvc has joined #ruby
SanguineAnomaly has joined #ruby
Garb0 has quit [Remote host closed the connection]
wymillerlinux has joined #ruby
mheld has joined #ruby
MrCrackPot has joined #ruby
MrCrackPot has quit [Remote host closed the connection]
blackmesa1 has joined #ruby
mikecmpbll has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
gavlee has joined #ruby
Esa__ has quit []
cnsvc has quit [Ping timeout: 240 seconds]
<havenwood> xco: radar has logs for ror
<xco> havenwood thanks. i'll ask him for the link later. i was just wondering if you had posted a reply to this https://gyazo.com/e6330364cc63e13fd4bae887382338e8
<havenwood> xco: Yup! Sec.
<xco> my client logged me off and i couldn't get anything that came after
<havenwood> [17:11:57] <havenwood>: xc, Was afk. Yup!
<havenwood> xco: Yes, exactly.
<havenwood> xco: It's along the same lines as a default order.
<xco> havenwood awesome. everything makes sense now then
<xco> or even #reorder
<havenwood> xco: It's considered a bit more of an anti-pattern to have a default order. Yup, exactly—#reorder.
<xco> it saves you writing another scope i'll guess
<xco> if you're lazy or just won't use that scope much
<havenwood> and if there's a default scope, it saves you from backbending to undo it.
<havenwood> it's not a super common occurrence, but it happens enough for the #re# methods to exist.
<xco> havenwood personsally i haven't seen it used anywhere before!
<havenwood> xco: I agree the examples look odd!
<havenwood> xco: I see reorder more often.
<havenwood> More often than rewhere.
ellcs has quit [Ping timeout: 260 seconds]
<havenwood> xco: #rewhere is rare.
<havenwood> xco: If you have a cloud server floating around somewhere, it might be worth setting up ZNC for automatic log replay when you reconnect.
<havenwood> xco: IRC is nicer with ZNC.
<xco> havenwood on your comment "the examples look odd!" is the same problem Avdi was talking about recently...that a lot of then things in Rails are meant for the experts, costing Rails some contributors, now i sort of know what he meant but that's more philosophical than anything
<havenwood> xco: Ruby is meant for expert C programmers and Rails is meant for expert webapp developers. ¯\_(ツ)_/¯ Nobody realized!
<xco> havenwood i was reading about ZNC yesterday, then I saw " IRC bouncer" and immediately stopped reading haha.. Bouncer??? what's that supposed to mean?
<havenwood> xco: Sometimes it's worth catering to experts but giving a ramp for beginners. Larry Wall has spoken eloquently on this topic.
<havenwood> xco: An IRC bouncer logs onto IRC for you then you log onto it instead of the IRC server and it bounces you the messages.
<xco> "Ruby is meant for expert C programmers"<< this i noticed rather years ago!!! and i can agree to this "Rails is meant for expert webapp developers."
<havenwood> xco: Who is Matz? An expert C programmer. Who is DHH? An expert webapp developer. They made them for themselves, so it checks out.
<havenwood> xco: A bouncer is basically like if IRC replayed everything you missed whenever you reconnect.
<xco> i'm on that page :P
ellcs has joined #ruby
<xco> the "bouncer" name though got me tripping
<havenwood> xco: It's a bit annoying to set up but well worth it.
<havenwood> Set up once, enjoy for years.
<xco> the images in that link make friendlier
<xco> it*
rmnull has joined #ruby
rmnull has quit [Client Quit]
<adam12> Another reasonable alternative is IRCCloud.
sergioro has joined #ruby
drincruz has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drincruz has quit [Ping timeout: 258 seconds]
FastJack has quit [Ping timeout: 256 seconds]
<xco> +1
FastJack has joined #ruby
<xco> i know about this ['Cat', 'Dog', 'Bird'].include?('Unicorn')
<xco> => false
<xco> I just learned about this one
<xco> 'Unicorn'.in?(['Cat', 'Dog', 'Bird'])
<xco> => false
<havenwood> xco: Rails, not Ruby. :)
<xco> didn't know such a thing existed hahaha
<havenwood> xco: It doesn't in Ruby!
<xco> holy shit!
<havenwood> It's been proposed.
<xco> you're right!
<xco> well... if it's been proposed and ignored i can understand it
<xco> #include? is enough i'd think
<xco> I don't know what #include? can't do that #in? would do
<havenwood> xco: Matz agrees
<xco> really?
<xco> when should we expect it then? any plans you know of?
<havenwood> xco: I mean he agrees it's redundant and unnecessary.
<xco> hahahha
<xco> rightly so!
<xco> for me it would be shorter to type but that's not important
<xco> we shouldn't add redundant things
<xco> and i just read "There is an in? method in ActiveSupport (part of Rails) since v3.1, as pointed out by"
<xco> i would have been surprised i still don't know this in Ruby after all this while... i don't know a lot of things in Ruby still though but THIS i would have jumped out of my balcony
<xco> but sometimes it's hard to know where AS ends and where Ruby start or vice versa
<xco> not that i'm irritated by it, but it's annoying when tech companies want to test you on that
<xco> that would mean knowing Ruby or Rails in its entirety to be able to know what doesn't belong in one
<xco> :D :D
<xco> which is not possible unless you're Matz
ropeney has quit [Ping timeout: 256 seconds]
<havenwood> xco: I learned Ruby for years before touching Rails, so I know by exclusion.
<xco> EDIT: which is not possible unless you're Matz or havenwood or adam12 or phaul or al2o3-cr
<xco> havenwood for those years this you work with just Ruby? without any framework? that'd be some hard core stuff then
ldepandis has joined #ruby
<havenwood> xco: Sinatra apps and APIs for mobile and embedded devices mostly. Nothing too hardcore, but some of the embedded project APIs were fun. Got a few patents and sold the startup to Scientific Games.
<havenwood> xco: I considered Rails more challenging!
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #ruby
ropeney has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
<xco> nice! i was thinking you did Ruby without frameworks. because apparently a lot of people use Rails even for the simplest APIs which i find overkill
<xco> for apis i can agree Sinatra and even Hanami API are just fine
<havenwood> xco: I switched from Sinatra to Roda at some point.
Xiti` has joined #ruby
<havenwood> xco: My first brush with Rails was writing a Sinatra API for a mobile app against a Rails DB. :O
Pixi__ has joined #ruby
<xco> havenwood that's quite common, i've seen the Sinatara api against Rails done a few times
<havenwood> The mobile team had a very specific, but moving target that was onerous for the Rails team at the time. I wouldn't do it the same today, but it worked well.
Xiti has quit [Ping timeout: 240 seconds]
<havenwood> xco: I did non-web Ruby without frameworks too. It seems simpler to me when web isn't involved though—not more complex.
<xco> but good experiences i guess, now you're well-versed on both the small (Sinatra) and big (Rails) frameworks and the language that connects them (Ruby). before i got into Rails some book (i don't remember) advised me to learn Sinatra first (which I did) before coming to Rails. After a few months i had mastered Sinatra... after years I still haven't mastered Rails and have forgotten almost all my Sinatra!
Xiti` has quit [Ping timeout: 240 seconds]
alexherbo2 has quit [Ping timeout: 246 seconds]
<havenwood> xco: Coding is such a large surface area you can't help but get niche expertise.
<havenwood> Impossible to learn it all.
lxsameer has joined #ruby
<havenwood> Which is lovely, since there's no need to switch fields when you get bored.
<xco> you just pick another language/framework then
<xco> agree
<havenwood> after bird law, I ran out of options
<havenwood> xco: or security, ops, system programming, data science, so much
cliluw has quit [Ping timeout: 260 seconds]
<havenwood> xco: or even in Ruby stuff like telephony, networking, machine learning, and whatever else can all be explored.
gitter1234 has quit [Quit: Connection closed for inactivity]
imode has joined #ruby
sagax has quit [Quit: Konversation terminated!]
<havenwood> Can anyone spot areas for improvement? https://gist.github.com/havenwood/5e5c58a89235d0758db177a7c01a7fc6
<havenwood> I tried to match Enumerable#lazy behavior but with #memoized.
ChmEarl has joined #ruby
Garb0 has joined #ruby
schne1der has quit [Ping timeout: 272 seconds]
plutes has quit [Ping timeout: 256 seconds]
plutes has joined #ruby
s2013 has joined #ruby
imjoehaines has quit [Remote host closed the connection]
conta has joined #ruby
alexherbo25 has joined #ruby
orbyt_ has joined #ruby
oneeggeach has joined #ruby
oneeggeach has quit [Client Quit]
kinduff has quit [Read error: Connection reset by peer]
alexherbo2 has joined #ruby
kinduff has joined #ruby
alexherbo25 has quit [Ping timeout: 264 seconds]
<xco> havenwood i see something i'd like to ask about though... and i read about it but forgot. the rails on L26 will raise INTERRUPT again correct? why are you doing that?
chouhoulis has joined #ruby
<havenwood> xco: It's fine for it to raise, it just needs to rewind first so it doesn't get left in a transient state.
<havenwood> xco: The interrupt is meant to happen.
<havenwood> xco: I should comment but it's just a code spike.
cliluw has joined #ruby
<xco> got it
Rakko has joined #ruby
chouhoulis has quit [Ping timeout: 256 seconds]
wymillerlinux has quit [Remote host closed the connection]
drincruz has joined #ruby
wymillerlinux_ has joined #ruby
sergioro has quit [Quit: leaving]
troulouliou_dev has quit [Read error: Connection reset by peer]
sergioro has joined #ruby
cliluw has quit [Ping timeout: 244 seconds]
cliluw has joined #ruby
drincruz has quit [Ping timeout: 264 seconds]
sergioro has quit [Quit: leaving]
chalkmonster has quit [Quit: WeeChat 2.8]
sergioro has joined #ruby
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
<xco> what are some of the techniques to safely override Ruby core functionality apart from "refinements"?
Rakko has quit [Quit: Leaving]
<xco> buy "safely" i mean overriding functionality in a way that a method doesn't seep all the way to the intepreter as a general method
<xco> by* (you get it)
<havenwood> xco: You can `unless respond_to?(:foo); def foo(...)` but it's overbearing and something that only behemoths like Rails can get away with.
<havenwood> xco: Refinements are really the way to lexically monkey patch, if you want to keep your footprint sane.
<havenwood> xco: Otherwise, use a function rather than opening a core class for modification.
<havenwood> I think it's fair to say *never* define a method on a core class, unless you do so with a refinement these days.
schne1der has joined #ruby
<xco> how about overriding the method on a per object basis? would that be sane?
<xco> something along the lines of def object.length; ... end
<havenwood> xco: Yes, there are cases where you define a method on an instance of object, or that sort of thing. That doesn't leak and become insidious when others do it too.
<havenwood> Create an object, define a method, freeze it!
<xco> ok so we have 2 ways to do this safely. Refinements and Singleton methods. agree? havenwood
<havenwood> xco: No chance of breaking anyone else's code. :)
<xco> oh that's a cool technique too!
<havenwood> xco: You can open up anything within your own namespace.
<xco> what if it's not namespaced? or you don't want namespacing?
<xco> would singleton methods be safe?
<xco> i think yes.... right?
<havenwood> xco: Depends what you're defining the singleton on. :P
<xco> because the method would be ONLY on one object, so you don't need to worry about whether or not its namespaced
<havenwood> xco: If you only define methods on objects you've created, I'd think you'd be good.
<xco> well i'd think you can do it on any object!
<xco> oh?
<xco> btw how do you find things so fast?! talking about Jeremy Evans's example :D :D
<xco> hhahaha
<havenwood> xco: Class.define_singleton_method(:new, ->{ abort })
<havenwood> xco: "Define singleton method" is just too broad.
<xco> single method = a method defined in the eigenclass of an object
<havenwood> xco: eigenclass and singleton class are the same thing.
<xco> yes... so a singleton method here is a method defined in the singleton class of an object :)
<havenwood> xco: Core classes are objects though, so you can get into trouble defining singleton methods on them.
<xco> hmmm
<havenwood> I'm just saying it's not safe to define singleton methods as a general rule. Sometime.
<havenwood> You can define methods on objects you've created.
<havenwood> That *seems* like a fairly safe statement to me.
<havenwood> If you create a class or instance of a class, define away.
<havenwood> If the object already exists, I'd say it seems messy to define a method on it.
<havenwood> Someone else could too, then... chaos.
<xco> that's leaves refinements as the only way then
<havenwood> Matz wouldn't have rocked the boat hard enough to create them if there was a good alternative.
<xco> aside someone else overriding your override would it be safe then? just assuming...
<havenwood> xco: if you don't override an existing method to make yours work, how does yours work?
markopasha has joined #ruby
<havenwood> you can have a fallback, but uhg. it gets messy fast.
<havenwood> xco: It's kinda fine for a *single* player to do this, like Rails does. Everyone else in the ecosystem has to refrain. You see some Rails gems also monkey patch core classes, but it's mostly Rails that does it.
<havenwood> Rails was written before refinements exist, too.
<havenwood> xco: I've had great luck using refinements with Rails. They *just work*.
<havenwood> And no ensuing chaos.
<xco> right
renich has joined #ruby
<havenwood> My only gripe is them not working by default at top level in irb and Pry.
<xco> there's a reason refinements are module-scoped
<havenwood> They work in irb at top level if you set: IRB.conf[:CONTEXT_MODE] = 0
<havenwood> I'd actually like the default :CONTEXT_MODE to be changed from 3 to 0.
<xco> i haven't seen CONTEXT_MODE mode before
<xco> what does it do?
<xco> CONTEXT_MODE (number): Sets the type of binding that irb uses when evaluating statements. Can be either 0, 1, 2 or 3 (3 is the default).
alexherbo2 has quit [Ping timeout: 256 seconds]
markopasha has quit [Quit: WeeChat 2.8]
Garb0 has quit [Quit: Leaving]
conta has quit [Quit: conta]
inguz has joined #ruby
jeromelanteri has joined #ruby
<havenwood> xco: It's about where the TOPLEVEL_BINDING is going to be in. With 3 it's a function. With 0 it's a proc.
<havenwood> xco: 1 is a tempfile. I can't remember what 2 is.
blackmesa1 has joined #ruby
<havenwood> 0 works great. ¯\_(ツ)_/¯ Unsure why one would want the default, 3.
<xco> yup. i tried to look for documentation on it with no luck
<xco> do you have yours set to 0 in the confs?
<xco> :D
<adam12> Interesting trick.
<adam12> Does pry need the same trick?
<havenwood> adam12: I'm not sure how to do the Pry equivalent, but that'd be worth figuring out...
<adam12> havenwood: Ah. I thought you just recently migrated from pry to irb.
<havenwood> adam12: Pry doesn't support refinements, but it should.
<havenwood> adam12: With Pry I just cd. :P
<havenwood> adam12: Since I can work around it with Pry, I didn't get enough pain to delve deeper.
<havenwood> We should do a PR to add top level refinement support for Pry.
<livcd> Anyone running on the Graal stack in prod?
<havenwood> adam12: irb doesn't have -e either for hacks like: pry -r 'class Foo; binding.pry end'
dfucci has joined #ruby
chouhoulis has joined #ruby
<havenwood> adam12: I think it not working by default in the REPL really discourages use, which is unfortunate.
<al2o3-cr> havenwood: pry -c TOPLEVEL_BINDING
<havenwood> al2o3-cr: Ah, perfect!
<havenwood> Thanks
<al2o3-cr> havenwood: np.
<xco> al2o3-cr 👋🏾😃
<havenwood> al2o3-cr: adam12: Okay, so .pryrc: Pry.config.toplevel_binding = TOPLEVEL_BINDING
<al2o3-cr> havenwood: that'll do it.
<havenwood> al2o3-cr: but... it doesn't. Hrm.
<havenwood> al2o3-cr: Ah, already set to nil.
<havenwood> Bah.
<havenwood> An alias it is...
blackmesa1 has quit [Ping timeout: 240 seconds]
<havenwood> Or...
<al2o3-cr> well shit, that used to work.
<havenwood> al2o3-cr: The flag works, but not the config. I guess the config happens too late.
<al2o3-cr> havenwood: hang on...
<al2o3-cr> i'm sure i've had this working before, using .pryrc
mikecmpbll has quit [Quit: inabit. zz.]
woodruffw has joined #ruby
<havenwood> al2o3-cr: It work inception style, but that's of course no good: Pry.config.toplevel_binding = TOPLEVEL_BINDING.eval('pry')
<havenwood> The Pry bug for it is as old as refinements.
<al2o3-cr> hmm.. i'm not sure if i was dreaming or not now ;)
cnsvc has joined #ruby
chalkmonster has joined #ruby
conta has joined #ruby
<havenwood> al2o3-cr: The irb context 1 seems to work cleanly, other than the temporary tempfile as a side effect. 0 throws up but then works too.
wymillerlinux_ is now known as wymillerlinux
<al2o3-cr> havenwood: i'll get back to you on this one :(
dfucci has quit [Quit: Lost terminal]
ur5us has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
inguz is now known as far_out
renich has quit [Quit: renich]
blackmesa1 has joined #ruby
renich has joined #ruby
far_out is now known as seaef
<havenwood> al2o3-cr: adam12: This is my current stab, which does work. https://gist.github.com/havenwood/c42f866040db28af95a83823cc2aff1e
<adam12> Heh
<al2o3-cr> haha :) nice one havenwood
sagax has joined #ruby
caterfxo has quit [Ping timeout: 240 seconds]
Pixi__ has quit [Quit: Leaving]
Xiti has joined #ruby
mjsir911 has quit [Quit: Goodbye, World!]
blackmesa has joined #ruby
NGC3982 has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
<NGC3982> hi. when i run ruby --version it tells me 2.7.0p0, but when i run "sudo gem install lita" i get "ERROR: Error installing lita: bundler requires Ruby version >= 2.3.0"
<NGC3982> any suggestions? it seems like i havent properly upgraded ruby ..i guess?
<NGC3982> gem env tells me that GEM PATHS are /home/henrik/.rvm/gems/ruby-2.7.0
<al2o3-cr> havenwood: now i remember how i did it ;)
cnsvc has joined #ruby
_aeris_ has quit [Quit: ZNC - http://znc.sourceforge.net]
_aeris_ has joined #ruby
<al2o3-cr> Pry.hooks.add_hook(:when_started, 'context_switch') { |_, _, pry| pry.binding_stack << TOPLEVEL_BINDING } # add this to ~/.pryrc
<al2o3-cr> that'll drop you into the top level binding. just cd to escape ;)
<al2o3-cr> well, adds it to the binding stack.
<al2o3-cr> ^ havenwood:
cnsvc has quit [Ping timeout: 240 seconds]
<al2o3-cr> that's from booting my other thinkpad and looking at my .pryrc, although i used before_session then.
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
<adam12> NGC3982: sudo normally strips some environment variables and resets others. PATH can be one of tem. If you're using rvm, often it's user specific.
<adam12> NGC3982: That said, you might not need `sudo` when running gem here.
ellcs has quit [Ping timeout: 256 seconds]
tubbo is now known as tubbo|afk
tubbo|afk is now known as tubbo
seaef has quit [Quit: I am functioning within established parameters.]
conta has quit [Quit: conta]
goepsilongo has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
<havenwood> NGC3982: `rvmsudo` is an RVM command or RVM has "wrappers" that set env.
<havenwood> NGC3982: See `rvmsudo --help` and `rvm help wrapper`.
<havenwood> NGC3982: Both will preserve relevant env.
rapha has left #ruby ["WeeChat 2.3"]
cnsvc has joined #ruby
woodruffw has quit [Excess Flood]
woodruffw has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
ellcs has joined #ruby
schne1der has quit [Remote host closed the connection]
tubbo is now known as tubbo|afk
tomg has quit [Quit: Leaving]
tomg has joined #ruby
tubbo|afk is now known as tubbo
ellcs has quit [Ping timeout: 256 seconds]
woodruffw has quit [Ping timeout: 258 seconds]
<hodbogi> I never thought I'd have to cover my engine compartment with fire retardant.
<hodbogi> wrong window...
<apotheon> That's an amusing non-sequitur here.
<hodbogi> yeah my carburetor likes to breathe fire and I started it up before cleaning up all of the gas that leaked all over the engine
<apotheon> oops
<apotheon> Don't, uh, *do* that.
<apotheon> Why is your carburetor breathing fire?
<hodbogi> I think the timing is way too advanced. its either that or the valves aren't seating properly so the spark is causing an explosion that shoots ouit of the carburetor
<apotheon> (That actually kinda sounds like Firefox. JavaScript is basically combining fuel and oxygen for injection of fire into the rendering engine, resulting in the kind of user experience that leaves one feeling burned.)
<hodbogi> lol
<hodbogi> it's a 1967 big block V8 its going to have some wear and tear
<apotheon> ooh
<hodbogi> I got it because of the pandemic and something to work on
<hodbogi> keep me busy
<apotheon> Chevelle?
<hodbogi> no, it's for a 24,000 pound truck
<apotheon> ah
<hodbogi> but its very similar to the engine they used in the cars its just the block walls are thicker so they can take more abuse
<apotheon> I like overengineered engines like that.
<hodbogi> yeah its nice, and aside from blocks and stuff the heads and valves and shafts and everything are interchangable
<apotheon> I have a 1987 Toyota SR5 4x4 pickup, and it's just a four-banger, but it's the sort of overengineered design that it'll still be functional 25 years after the apocalypse.
<hodbogi> heh
<apotheon> s/that it'll/that'll/
<hodbogi> this is a Ford F-700
<apotheon> old enough to be worth maintaining
<hodbogi> I don't have much experience with fords but the parts are everywhere
<apotheon> My experience with Fords after 1980 is full of distaste.
<apotheon> The stick shifts seem prone to developing roughness and general shittiness after a couple years or so, and the automatics I've driven are just miserable to use (speaking of Fords with model years after 1980).
tubbo is now known as tubbo|afk
<apotheon> I should uninstall Rails turbolinks from my motorcycle.
<apotheon> (Watch me smoothly transition back to Ruby talk.)
<havenwood> apotheon: I thought you were going to segue on engine block. :)
<apotheon> good idea
<apotheon> damn
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
d3bug has joined #ruby
ritalinona has quit [Quit: bleep]
tubbo|afk is now known as tubbo
<hodbogi> apottheon: The transmission in this truck is pretty decent. It's a 5 speed and the differential is two speed so I essentially have 10 gears
<hodbogi> in a way
<hodbogi> in 1 low it will go like 5 miles per hour at 7000 rpm or so