havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.1, 3.0.3, 2.7.5: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
donofrio has quit [Ping timeout: 272 seconds]
swaggboi has quit [Ping timeout: 260 seconds]
comet23 has joined #ruby
d-s has quit [Read error: Connection reset by peer]
d-s has joined #ruby
<havenwood> hwrd: block argument
<mooff> 'the first parameter'
<havenwood> hwrd: it's a single, named block parameter
<havenwood> { _1 } would be a single, numbered block parameter
<havenwood> { |x| x } is like { _1 }
swaggboi has joined #ruby
donofrio has joined #ruby
comet23 has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
ur5us has joined #ruby
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dtroithist has joined #ruby
<dtroithist> That was weird. You guys banned all my IPs?
<dtroithist> I was drunk. Give a guy a break.
roadie has joined #ruby
<dtroithist> But *why* though?
<dtroithist> I can't remember bullying anybody
<dtroithist> Matter of fact if I see any bullies, I will f*** them up
<dtroithist> Ford Dearborn Master Plan by Snøhetta - https://www.youtube.com/watch?v=WcvF_dnoRWE
donofrio has quit [Ping timeout: 260 seconds]
reset has quit [Quit: reset]
John_Ivan has quit [Ping timeout: 252 seconds]
impermanence has joined #ruby
Rounin has quit [Ping timeout: 260 seconds]
donofrio has joined #ruby
Guest48 has joined #ruby
nirvdrum has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
donofrio has quit [Ping timeout: 260 seconds]
<havenwood> Ruby is the topic here.
<havenwood> I was hoping someone had some Ruby. :P
nirvdrum has quit [Read error: Connection reset by peer]
nirvdrum has joined #ruby
donofrio has joined #ruby
eddof13 has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
<mooff> some Ruby, you say? ;P https://dpaste.org/8UBY
lunarkitty has joined #ruby
Guest48 has quit [Ping timeout: 256 seconds]
<mooff> https://dpaste.org/muxB also hot off the press
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
o|||||o has quit [Ping timeout: 272 seconds]
donofrio has quit [Ping timeout: 260 seconds]
ged has joined #ruby
nirvdrum has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 260 seconds]
nirvdrum_ has joined #ruby
hanzo has joined #ruby
roadie has joined #ruby
o|||||o has joined #ruby
nirvdrum_ has quit [Read error: Connection reset by peer]
roadie has quit [Ping timeout: 260 seconds]
nirvdrum has joined #ruby
CrazyEddy has quit [Ping timeout: 240 seconds]
nirvdrum has quit [Read error: Connection reset by peer]
nirvdrum has joined #ruby
CrazyEddy has joined #ruby
roadie has joined #ruby
nirvdrum has quit [Read error: Connection reset by peer]
nirvdrum_ has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
nirvdrum_ has quit [Read error: Connection reset by peer]
nirvdrum has joined #ruby
nirvdrum has quit [Read error: Connection reset by peer]
nirvdrum_ has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
eddof13 has joined #ruby
lunarkitty has quit [Quit: Connection closed for inactivity]
nirvdrum_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ua_ has quit [Ping timeout: 260 seconds]
ua_ has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
<ox1eef> mooff: i saw your comment, thanks. ive become sort of stuck when it comes to specific decisions, like should object.class = 'bar' work? it works in openstruct, but also makes it error out in cases where 'class' is used. i think JS allows it and by magic of its implementation avoids errors in its internals.
<ox1eef> its much easier to follow JS as close as possible, and avoiding thinking of those kind of decisions altogether.
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef> another thing ive been conscious of is defining as few methods as possible, and so i might move private instance methods to a Utils module that doesn't pollute self
teclator has joined #ruby
jmcgnh has quit [Remote host closed the connection]
<jhass[m]> adam12: Sure, couple of fresh folks sounds good if anyone is up for it
jmcgnh has joined #ruby
ur5us has joined #ruby
thad_the_man has quit [Read error: Connection reset by peer]
thad_the_man has joined #ruby
Rounin has joined #ruby
d-s has quit [Quit: Leaving...]
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
jmcgnh has quit [Ping timeout: 246 seconds]
oxfuxxx has joined #ruby
jmcgnh has joined #ruby
fandre1986 has joined #ruby
dionysus69 has joined #ruby
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
Tempesta has quit [Read error: Connection reset by peer]
mjacob has quit [Read error: Connection reset by peer]
mjacob has joined #ruby
Guest48 has joined #ruby
CrazyEddy has quit [Ping timeout: 256 seconds]
oxfuxxx has quit [Ping timeout: 260 seconds]
CrazyEddy has joined #ruby
oxfuxxx has joined #ruby
gproto23 has joined #ruby
roadie has quit [Ping timeout: 245 seconds]
taupiqueur has joined #ruby
Tempesta has joined #ruby
roadie has joined #ruby
donofrio has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
John_Ivan has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
roadie has joined #ruby
oxfuxxx has quit [Ping timeout: 260 seconds]
oxfuxxx has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
roadie has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
yxhuvud has quit [Read error: Connection reset by peer]
oxfuxxx has joined #ruby
yxhuvud has joined #ruby
ur5us_ has quit [Ping timeout: 240 seconds]
dtroithist has quit [Quit: Lost terminal]
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oxfuxxx has quit [Ping timeout: 260 seconds]
markong has joined #ruby
some14u has joined #ruby
some14u has quit [Client Quit]
o|||||o has quit [Ping timeout: 260 seconds]
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
o|||||o has joined #ruby
<henk> what is state of the art option parsing? OptionParser, optparse, …?
some14u has joined #ruby
<ox1eef> there's also Slop
Guest48_ has joined #ruby
Guest48_ has quit [Client Quit]
<henk> ox1eef: would you recommend it over others?
<ox1eef> i haven't used it in quite some time, and the version i was using is quite old. the old versions had some quirks i believe older major versions addressed.
<ox1eef> s/older/newer/*
<mooff> Slop looks nice. i've not used it, but hope to
<mooff> for a shareable script i'd want to rely on the stdlib. for that case there's OptionParser and GetoptLong
<mooff> ox1eef: i guess it depends whether you want it to be more BasicObject than Object-like, as a Ruby user of it
<ox1eef> right now you can do: Object.create(nil, superclass: BasicObject)
<ox1eef> ive been tinkering with it a bit, ive added Proto::Object and made the Object.create monkeypatch opt-in by require of core_ext/object
<mooff> cool
<henk> ox1eef, mooff: thanks
<ox1eef> welcome
<mooff> ^
SobiX has joined #ruby
SobiX has quit [Quit: Client closed]
<mooff> ox1eef: JS relies on Object.foo() methods for reflection and manipulation rather than stuff on object prototypes themselves
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oxfuxxx has joined #ruby
<mooff> the main one that was there __proto__ is deprecated in favour of Object.getPrototypeOf(), .setPrototypeOf()
<ox1eef> indeed, it largely avoids the pitfalls that exist in ruby afaik.
fandre1986 has quit [Quit: Connection closed]
<ox1eef> ahh interesting..
<ox1eef> :: OpenStruct.new(class: 42).class!
<ruby-eval> ERROR: uninitialized constant OpenStruct
<ox1eef> :: require 'ostruct'; OpenStruct.new(class: 42).class!
<ruby-eval> => OpenStruct
<ox1eef> it has that convention
<mooff> heh, that's one solution!
<ox1eef> indeed
<mooff> if you hope to leave the choice up to the user, maybe it's possible to avoid defining #class and #singleton_class
<mooff> #inspect uses self.class, but could check Object === self instead
<ox1eef> i'm in the process of stripping the module as much as i can, and then the barest object would be Proto::Object.create(proto, superclass: BasicObject)
<mooff> method_defined? could use (class << self; self; end) instead of singleton_class
<ox1eef> good call +1
Guest48_ has joined #ruby
Guest48_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest48_ has joined #ruby
reset has joined #ruby
Guest48_ has quit [Quit: Textual IRC Client: www.textualapp.com]
favadi has joined #ruby
<adam12> Morning
taupiqueur has quit [Ping timeout: 260 seconds]
taupiqueur_ has joined #ruby
taupiqueur has joined #ruby
taupiqueur_ has quit [Ping timeout: 272 seconds]
roadie has quit [Ping timeout: 260 seconds]
impermanence has quit [Quit: Connection closed]
taupiqueur_ has joined #ruby
taupiqueur has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
nirvdrum has joined #ruby
<ox1eef> good morning adam12
<ox1eef> mooff: maybe it is too clever but i ended up doing this: https://github.com/0x1eef/proto.rb/commit/aeb0b08b93b162190f15c511ad8161f05d33d185 - kind of similar to the Object.foo JS approach you mentioned earlier.
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
oxfuxxx has quit [Ping timeout: 272 seconds]
oxfuxxx has joined #ruby
Guest85 has joined #ruby
<Guest85> Hi everyone ,
<Guest85> Is it possible to update default gems in place? to avoid having default gem + both the updated version?
<ox1eef> not that i know of, i think you have to remove older versions manually.
<Guest85> ok, thanks a lot ox1eef !
rawley has joined #ruby
RedNifre2 is now known as RedNifre
<ox1eef> welcome
eddof13 has joined #ruby
some14u has joined #ruby
some14u- has joined #ruby
some14u has quit [Read error: Connection reset by peer]
some14u- has quit [Client Quit]
gproto23 has quit [Read error: Connection reset by peer]
some14u has joined #ruby
_ht has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
some14u has quit [Read error: Connection reset by peer]
TomyWork has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oxfuxxx has quit [Ping timeout: 246 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
taupiqueur has joined #ruby
taupiqueur_ has quit [Ping timeout: 260 seconds]
taupiqueur has quit [Quit: taupiqueur]
chirukodati has joined #ruby
<chirukodati> Hi, https://github.com/kratos6753/leftpad/runs/5774888559?check_suite_focus=true >> can someone, help me with why github action failed while setting up ruby - 3.1.1 ?
<adam12> chirukodati: bundle lock --add-platform x86_64-linux
<adam12> chirukodati: then commit and push
<isene> It would be cool if anyone in here could check out XRPN; https://github.com/isene/xrpn
<isene> XRPN is a new programming language written in Ruby. It is stack-based, similar to Forth, Raven and Postscript. It is a superset of the HP-41 programming language, FOCAL.
<chirukodati> M1 mac problems :(
eddof13 has joined #ruby
<adam12> isene: Fascinating stuff.
<adam12> chirukodati: lol yep.
<isene> adam12: I'm at something like 50 hours so far, wondering what to add next to the language. I'm hoping it will keep me busy for quite some time. But to achieve that, I could do with some feedback.
<chirukodati> Thanks adam12. It worked.
<adam12> chirukodati: cheers.
<apotheon> adam12: Is your username from a TV series?
<adam12> apotheon: Yea :)
<apotheon> I've been wondering that for a while.
<apotheon> a long while
<adam12> LOL
<apotheon> I just finally decided I was curious enough to ask.
<apotheon> I think I saw a grand total of about ten minutes of it once.
<adam12> I picked it a 100 years ago and it's stuck, tho I wish the show was Adam65535 because on some sites, adam12 is already taken due to the incremental nature of it.
<adam12> Yeah, it's a very old show.
<apotheon> yep
<apotheon> I'm a very old person.
<adam12> Likewise O_O
eddof13_ has joined #ruby
<apotheon> You *might* be older than me, given your enthusiasm for Adam-12.
<apotheon> I think something like three episodes aired since my birth.
<adam12> I'd bet we're the same age.
<adam12> It's just naming things is hard, and a 100 years ago I picked a name that stuck due to a passing familiarity to a show.
<apotheon> gotcha
<mooff> so you're saying apotheon is more than a hundred years old?!
<mooff> also very nice ox1eef
<apotheon> mooff: contemporary of folks like Lao Tzu and Diogenes
apotheon is now known as ElderMalaclypse
<adam12> heh
<ElderMalaclypse> I'm kind of a discordian taoist, y'know.
<adam12> O_o
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
markong has quit [Ping timeout: 260 seconds]
rawley has quit [Ping timeout: 246 seconds]
eddof13_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> One interesting (to me anyway) thing about building gemdocs.org is that I see some new interesting gems I'm not sure I'd ever discovered by hand. But also very strange (to me anyway) deployment processes. Such as this one gem that I just saw push 20+ pre-releases in the span of a few minutes, and it's up to pre.1093 as a version number?
eddof13 has joined #ruby
<adam12> I'm tempted to add the ability to generate gems on-demand; visit /gems/foobar/1.2.3 and it will build it if it doesn't already have it.
taupiqueur has joined #ruby
Guest85 has quit [Quit: Client closed]
hololeap_ has joined #ruby
hololeap has quit [Ping timeout: 240 seconds]
rawley has joined #ruby
Guest26nakilon has joined #ruby
<Guest26nakilon> mooff I have no bnc now
phenom has quit [Ping timeout: 240 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Guest26nakilon> basically there are some euristics to decide how to render the Pod, and if it's yet not supported it shows up as "| unsupported scanner |" among  other pods
<Guest26nakilon> you can join ##nakilon and enter '\help wa' to play with the bot, not sure for how many days it will be alive yet
donofrio has quit [Ping timeout: 246 seconds]
chirukodati has quit [Quit: Client closed]
<Guest26nakilon> and about the "short answer interface", not sure what is the official API but maybe it's a shortcut to limiting the response to just the "primary" pod, but that pod isn't always the best one, and sometimes is absent, and sometimes there are several of them so it's all incosistent and had to be handled in my code
<leah2> TZ=Europe/Berlin ruby -e 'p Time.at(-10000000000)'
<leah2> weird TZ offset?
<leah2> is that 53min?
emcb59 has joined #ruby
taupiqueur_ has joined #ruby
<Guest26nakilon> time measurement wasn't precise that long ago
<Guest26nakilon> but it says +0100 for me, I don't get your question
emcb5 has quit [Ping timeout: 260 seconds]
emcb59 is now known as emcb5
taupiqueur has quit [Ping timeout: 260 seconds]
phenom has joined #ruby
donofrio has joined #ruby
<mooff> neat, thanks for sharing :)
<Guest26nakilon> not sure, it was intended to work, not to be neat ..D
taupiqueur_ has quit [Ping timeout: 240 seconds]
rawley has quit [Ping timeout: 272 seconds]
taupiqueur has joined #ruby
eddof13 has joined #ruby
Guest26nakilon has quit [Quit: Client closed]
emcb58 has joined #ruby
emcb5 has quit [Ping timeout: 240 seconds]
emcb58 is now known as emcb5
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
howdoi has joined #ruby
eddof13_ has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leah2> here it is 1653-02-10 07:06:48 +005328
<Rounin> leah2: Are you sure that's not something else at the end, like milliseconds or nanoseconds?
<leah2> you mean seconds? :)
some14u has joined #ruby
<Rounin> Hmm... It's happening between -2422000000 and -2422100000... Isn't that suspiciously similar to 2**32 - 1, which is 2147483647?
<Rounin> Perhaps something somewhere is using a 32-bit size for something and doing something confusing with signedness
<Rounin> david@winterfell:~: TZ=Europe/Berlin ruby -e 'p Time.at(-2422054408)'
<Rounin> 1893-04-01 00:06:32 +0100
<Rounin> david@winterfell:~: TZ=Europe/Berlin ruby -e 'p Time.at(-2422054409)'
<Rounin> 1893-03-31 23:59:59 +0053
<leah2> but yours only prints 4 digits?
<Rounin> Well, perhaps the Greenwich meridian wasn't used before then
<leah2> what system is that?
<leah2> i mean 53min off utc could make sense
<Rounin> Didn't places tend to use local time until quite recently? So the Berlin timezone might actually have had that offset
<leah2> that's solar time maybe
<Rounin> 53 minutes from Greenwich... Makes sense
<Rounin> Yeah
<Rounin> And then they started using faster trains, and in 1893 they standardized
<Rounin> But yeah, only 4 digits
<leah2> is that linux?
<Rounin> Yeah... Could be a locale thing I suppose
phenom has quit [Ping timeout: 245 seconds]
<Rounin> LC_TIME=nb_NO.UTF-8
<Rounin> Same result with en_US.UTF-8 and C, though
<Rounin> That's a pretty thorough database, though, if it's got solar time in Berlin in 1893
phenom has joined #ruby
hanzo has quit [Quit: Connection closed for inactivity]
nmollerup has quit [Quit: Leaving]
_ht has quit [Remote host closed the connection]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
some14u has joined #ruby
ur5us_ has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
emcb59 has joined #ruby
o|||||o has quit [Ping timeout: 260 seconds]
emcb5 has quit [Ping timeout: 250 seconds]
emcb59 is now known as emcb5
some14u has joined #ruby
markong has joined #ruby
cahoots has joined #ruby
<cahoots> hi, for each line of stdout or stderr that's outputted in my ruby script whether explicitly with puts or implicitly with system(...), i want to prepend a timestamp to it. is there any way to do this within ruby, and without a bash wrapper?
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
<cahoots> it appears i can reassign $stdout, but what exactly am i allowed to reassign it to? if i use a custom class that just overrides some necessary "write" method, is that enough?
<legit> cahoots: not sure if you're using it, but have you looked into open3 - https://rubyapi.org/3.1/o/open3 ?
ElderMalaclypse is now known as apotheon
wand has quit [Remote host closed the connection]
wand has joined #ruby
clemens3 has quit [Ping timeout: 256 seconds]
wand has quit [Ping timeout: 240 seconds]
wand has joined #ruby
<adam12> cahoots: You can re-assign $stdout if you want. I'd maybe use a SimpleDelegator and modify write(val)
<adam12> cat file | ruby -rdelegate -ne 'BEGIN { class MyOut < SimpleDelegator; def write(value); super("[#{Time.now.to_s}] " + value); end; end; $stdout = MyOut.new($stdout) }; print $_'
<cahoots> adam12, this seemed promising but it doesn't intercept the output of subshells
<cahoots> or of system('echo', 'hi')
<adam12> system probably accepts a fd for stdout
<adam12> which your custom class object likely doesn't have.
<cahoots> it does, but then you have to do it everywhere
<adam12> I can't look now. Maybe you can make an example if you're still stuck.
<adam12> bbiaf.
<cahoots> the example is simply system('echo', 'hi') not using $stdout
clemens3 has joined #ruby
<mooff> adam12: i never knew about BEGIN. cool feature.
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
<mooff> cahoots: maybe you could monkey patch Object#system
seifeslimene has joined #ruby
<mooff> reading back.. i'd use an IO.pipe as $stdout / $stderr
taupiqueur has quit [Ping timeout: 246 seconds]
esaym153 has joined #ruby
roadie has quit [Ping timeout: 245 seconds]
<esaym153> how do I print the contents of an object/array? Trying to debug a gitlab script, just using 'puts' gives me a list like http://paste.debian.net/plain/1236318
<esaym153> nm, I see .inspect
<mooff> cahoots: https://dpaste.org/pGUz
<mooff> try $stdout = line_wrapper { "[#{Time.now}] #{_1}" }
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadie has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadie has joined #ruby
SobiX has joined #ruby
nirvdrum has joined #ruby
o|||||o has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
<adam12> esaym153: Also `p` or `pp`.
<adam12> (instead of `puts`)
<mooff> system() doesn't seem to use $stdout or $stderr
hololeap_ is now known as hololeap
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
donofrio has quit [Ping timeout: 245 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us_ has quit [Ping timeout: 260 seconds]
SobiX has quit [Quit: Client closed]
Thanzex has quit [Read error: Connection reset by peer]
donofrio has joined #ruby
Thanzex4 has joined #ruby
integral has quit [Ping timeout: 245 seconds]
John_Ivan has quit [Ping timeout: 250 seconds]
integral has joined #ruby
SobiX has joined #ruby
eddof13 has joined #ruby
cahoots has quit [Ping timeout: 240 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]