havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 3.3.0-preview1: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
<adam12> aesthetikx: Woah. Didn't even think about tap. Very nice.
<johnjaye> are \v and \f standardized to be "white space" or not
<johnjaye> i noticed ruby considers them to match \s which i found strange
<johnjaye> normally people say \s is "space tab newline". but apparently it includes ^K and ^L
<weaksauce> /\s/ - A whitespace character: /[ \t\r\n\f\v]/
<johnjaye> where is that from
<weaksauce> the docs lay it out in pretty great detail
<johnjaye> hmm. i thought ruby-doc was the official source. am i wrong
<weaksauce> uh
<weaksauce> i am not certain
<weaksauce> yeah it looks to be the canonical docs
<johnjaye> it also says that. weird
<johnjaye> where was i reading it was space tab and newline
<weaksauce> that doc i linked to pulls from whatever source ruby-doc is using
<weaksauce> just better formatting
<weaksauce> (imo)
<weaksauce> unless you don't know much about regexp i think the docs are a more useful reference
<weaksauce> but if that's the case those guides are pretty useful too
<weaksauce> chatgpt gave some good output too
johnjaye has quit [Read error: Connection reset by peer]
<weaksauce> if you are curious
johnjaye has joined #ruby
<adam12> Consider docs.ruby-lang.org as official canonical. rubyapi.org is a nicer interface. ruby-doc.org is not official. rubydoc.info is not official.
<adam12> We have a proliferation of ruby doc sites, sadly. I've contributed to it by introducing gemdocs.org...
<johnjaye> eh. if you say so
<johnjaye> so it would probably be a bad idea to start a ruby.doc website i guess
<adam12> Hehe. Is that a legit tld? I want to re-document ruby...
<johnjaye> no but it could be. the permutations on just a few words are pretty much endless
<johnjaye> therubydoc. rubydocs. rubysdocs. ruby-docs, etc
<adam12> .docs is a real tld, tho I've never seen it in the wild.
<weaksauce> i guess it isn't cannon then hah
<johnjaye> i've seen .io a lot recently but dunno why
<johnjaye> like github.io instead of .com
<adam12> It sounds like docs.ruby-lang.org might be adopting the rubyreference from zverok.
<weaksauce> ruby docs have always been a sore part of the experience imo
<adam12> I still feel like we can do better.
<weaksauce> same
<johnjaye> how do you view them on the command line from irb
<weaksauce> rubyapi is really good though
<adam12> johnjaye: "help" in current versions. "show_doc" I think in newer versions.
<johnjaye> that's actually pretty reasonable
<adam12> `help` is going away I think.
<johnjaye> i mean it's literally the first thing an english speaker would think to type. probably not a good idea
<adam12> Since I think most people would expect `help` to actually be `show_cmds`
<adam12> I have a ton of doc ideas for Ruby, but zero time.
<weaksauce> i just have to say
<weaksauce> what the f
<adam12> and it would need some buy-in I think. I don't want to ship YYARD
<weaksauce> the top section of pages is completely nonsense order
<adam12> Yeah. There's talk about this one replacing it: https://rubyreferences.github.io/rubyref/
<adam12> I want to steal the Rust doc format. Much nicer, imho.
<weaksauce> anything would be better
<weaksauce> how is the doc in such a state after what? 30 years or something like that?
<johnjaye> seems like everybody has their own version of markdown. why not ruby
<adam12> I think that theme is from 2008 and never updated.
<adam12> I think we should adopt Asciidoc..
<johnjaye> why. aren't they all the same
<adam12> I like writing Markdown but once you stray into abdomations(sp?) and others, then you're into the wild west of markdown dialects.
<adam12> rdoc maintenance has just been super quiet lately. It does receive bug fixes, and I think v6 shipped with Ripper support, but that feels like it lately.
<weaksauce> that ruby-doc website would be better if it just went unders
<adam12> Agreed. I kind of wish it went kabut.
<adam12> kaput.
<adam12> It ranks higher than official site.
<weaksauce> using such an old version of whatever formatter that it's worse
<weaksauce> oh you know what they updated it
<weaksauce> almost new now
<adam12> Ooh you're right.
<adam12> The ads tho. Eeesh
<adam12> We had an entire period where everyone was told to `--no-ri --no-rdoc` their gem installs and I think we suffered immensely from it because fuck docs.
FetidToot has joined #ruby
rvalue has quit [Ping timeout: 240 seconds]
jhass has quit [Ping timeout: 256 seconds]
jhass has joined #ruby
caedmon has joined #ruby
rvalue has joined #ruby
caedmon has quit [Remote host closed the connection]
<blackmetal> yo guys
<blackmetal> so u ever listened to a song and been like "hmm.. i wish i had that in midi-format"
<leftylink> uh oh, are my links mostly to ruby-doc... let's see
<leftylink> pandabot: what's ruby globals
<leftylink> oh, okay
<blackmetal> then you came across https://basicpitch.spotify.com/ and was like yessss!!! finally those miley cyrus records
<blackmetal> anyway despite being spotify that audio 2 midi service kinda sucks
<blackmetal> but what if..
<blackmetal> we added some ruby and python libs to the mix. curious what you guys think. if it works i guess i could sell it to spotify
<blackmetal> havent fully tested it yet so dunno whether it works or not
<blackmetal> thoughts?
johnjaye has quit [Ping timeout: 264 seconds]
Avogad81 has joined #ruby
johnjaye has joined #ruby
Al2O3 has joined #ruby
ap4y has quit [Remote host closed the connection]
donofrio_ has joined #ruby
donofrio__ has joined #ruby
donofrio has quit [Ping timeout: 268 seconds]
donofrio_ has quit [Ping timeout: 268 seconds]
donofrio has joined #ruby
donofrio__ has quit [Ping timeout: 240 seconds]
Avogad81 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
_ht has joined #ruby
blackmetal has quit [Quit: Lost terminal]
grenierm has joined #ruby
grenierm has quit [Client Quit]
grenierm has joined #ruby
jhass has quit [Ping timeout: 240 seconds]
jhass has joined #ruby
moldorcoder7 has quit [Ping timeout: 268 seconds]
otisolsen70 has joined #ruby
sphex has quit [Ping timeout: 240 seconds]
donofrio_ has joined #ruby
donofrio has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
sphex has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
teclator has joined #ruby
Sankalp has quit [Ping timeout: 268 seconds]
Sankalp has joined #ruby
sphex has quit [Ping timeout: 240 seconds]
outcas has joined #ruby
outcas has quit [Ping timeout: 240 seconds]
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
___nick___ has joined #ruby
otisolsen70 has quit [Read error: Connection reset by peer]
sphex has joined #ruby
hwpplayer1 has joined #ruby
grenierm has quit [Quit: Client closed]
rvalue has quit [Ping timeout: 240 seconds]
sam113101 has quit [Ping timeout: 240 seconds]
zenzen[m] has joined #ruby
zenzen[m] has left #ruby [#ruby]
hwpplayer1 has quit [Ping timeout: 268 seconds]
rvalue has joined #ruby
TomyWork has joined #ruby
dza has quit [Quit: ]
dza has joined #ruby
dza has quit [Client Quit]
infinityfye has joined #ruby
dza has joined #ruby
dza has quit [Quit: ]
dza has joined #ruby
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
cout has quit [Remote host closed the connection]
sam113101 has joined #ruby
cek has joined #ruby
sam113101 has quit [Ping timeout: 250 seconds]
marahin has left #ruby [Leaving]
sickdyd has quit [Ping timeout: 240 seconds]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
mooff has quit [Remote host closed the connection]
sickdyd has joined #ruby
teclator has quit [Ping timeout: 264 seconds]
hwpplayer1 has joined #ruby
hightower2 has joined #ruby
teclator has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
sickdyd has joined #ruby
sickdyd_ has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
sickdyd_ has quit [Ping timeout: 240 seconds]
cAMP has joined #ruby
<cAMP> Hi #ruby. Anyone have time to help me rewrite an old Earth orbit class from 2017?
<cAMP> (it is self-contained, and should run from prompt from that paste)
<cAMP> I decided to use it for my OSS game project, Mutonex, so this will be GNU GPL 3.0
<rapha> no clue about math, cAMP, but this looks cool. how does one write games in Ruby?
<cAMP> hi rapha, I just write
<cAMP> but I did also write a game design for it
<rapha> i mean, like, what library does one use for the graphics?
<cAMP> rapha: there are many libraries for ruby like the classic SDL, but I was just going to use a browser-client. So its probably canvas-based renderer. Maybe a minimal three.js ripoff.
sickdyd_ has joined #ruby
<cAMP> here is an updated pastie, which shoudln't error out http://pastie.org/p/0dUFb5JNvYoL2C0b1E6uB5
<cAMP> rapha: so that Planet module would live in a server, and the engine would request the planet related values from it to calculate game state for game-world sector.
<cAMP> Or, can you find errors in this? http://pastie.org/p/0dUFb5JNvYoL2C0b1E6uB5
teclator has quit [Ping timeout: 268 seconds]
<cAMP> One thing I am wondering is how bad is it to have all of those modules inside the Planet module 'extend' their methods on the Planet module?
cek has quit [Quit: Connection closed for inactivity]
aerona9 has joined #ruby
entropie has quit [Quit: ""]
moldorcoder7 has joined #ruby
entropie has joined #ruby
aerona9 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
_ht has joined #ruby
slothby has quit [Quit: brb ... maybe]
mexen has joined #ruby
slothby has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
dza has quit [Quit: ]
dza has joined #ruby
<cAMP> updated the Planet module - now with real airpressure math! http://pastie.org/p/1vUzOsdf0pJzi6rWbh6FTy
<ox1eef_> Historically, ruby had quite a few libraries for writing games, at least 2D games. There was Ray from Mon_Ouie, the original Pry author wrote some C bindings for it as well. MacRuby had a successful iPhone app game. I'm not sure what it is like nowadays.
<rapha> just googled around and came upon https://leanpub.com/developing-games-with-ruby/read which might be interesting for cAMP
<cAMP> naw I'm all DIY
<rapha> also https://www.ruby2d.com/showcase/ ... 2D only but, hey, there's even a side scroller!
<cAMP> I'm not looking for info on ruby game libs or frameworks, I'll make all of that myself.
<rapha> cAMP: i didn't know that if someone wants to do DIY it's forbidden for them to read a book to gain some knowledge from :)
<ox1eef_> That's my approach to most problems, too
<cAMP> I'm more interested in idiomatic ruby and any feedback on the module/class/logic-level solutions I put in my pastes 8)
<cAMP> rapha: its just I don't need any of that
<rapha> would you be able of writing, say, a Vulkan wrapper yourself?
<rapha> (not that that book goes into that)
<cAMP> not interested in writing wrappers
<rapha> how would you approach 3D in a slow language like Ruby?
<cAMP> If you scroll above I kinda attempted to tell you earlier.
<ox1eef_> You can always drop down to C where you need speed.
<cAMP> But in general, with ruby I leverage the kernel and C libraries where fast stuff is needed.
<rapha> you said you're going to do it browser based
<rapha> hmm, that's inaccessible to me then
<rapha> C, that is
<cAMP> I'll write these in ruby first, some parts in ecmaland, and then whats needed I'll try to get rust-modules for.
<rapha> sounds pretty cool
<cAMP> I'm hoping the code is somewhat idiomatic, and easy to follow. Then maybe others will join the Mutonex project later.
<ox1eef_> C can be hard sometimes. It is very easy to shoot yourself in the foot with it, but great language to learn all the same.
<rapha> i had it when i did my 3-year specialized compsci degree thing, and i can do some simple things with it. or some a little more complex ones with C++ and something like the Arduino framework. but for more than that i think i lack both the intelligence as well as the grit.
<ox1eef_> It is a language that requires paying close atttention, that's for sure.
<rapha> yeah and then that attention is missing to keep an eye on the bigger picture. i've always admired people who can keep both in mind without their mental workload being through the roof from that.
<cAMP> C just requires you think the memory management through
<cAMP> other than that, its somewhat simple IMO
<rapha> simplicity can still result in enormous complexity.
<ox1eef_> simple, subtle and sometimes dangerous is how I would describe it.
<cAMP> Most languages today have all kinds of extensions, extras, bells and whistles. I find the best results come from using the simple. But then, I often want to do things like iterate methods in a module. Introspection. Then most languages fail totally. One can't even iterate the properties of a class or module.
<cAMP> Ruby is fun like that
<ox1eef_> I think Rust is a decent candidate to be a C successor. At least when it compiles, you can have reasonable confidence it works as intended. C can compile and then just blow up.
<cAMP> If you look at Rust, it comes from browser renderers. C++ gets too complex and memory-buggy. Segfault galore.
<cAMP> So, rust is now posed to be defacto browser lang. Just recently, rust modules for linux kernel became a thing. So linux kernel project supports rust. Something else may surface at any time, but to me looks like rust is the definitive language for the future.
<Shell> it's /a/ big language for the future, at least.
<cAMP> heh, "rust modules for linux kernel" is kinda bad english, but maybe you can still get that
<cAMP> FWIW, I've been learning rust on and off, but the base requirement for understanding coercion with lifecycles, scopes and memory management gets pretty confusing. But then, its better than doing it in your head, as with C.
<cAMP> Ruby feels so soft compared. Fire irb up, do weird metaprogramming.
hwpplayer1 has quit [Quit: cylater]
sam113101 has joined #ruby
roadie has joined #ruby
<ox1eef_> Ruby is awesome indeed.
<leftylink> let's see, was it in this channel where we had the conversation and someone's position was essentially "I am not saying Rust is good. I am not saying Rust is bad. I am saying we can't give a definite statement either way without practical evidence"
<leftylink> no, we probably would not have that conversation about Rust in #ruby , so it probably wasn't here
sam113101 has quit [Ping timeout: 268 seconds]
<johnjaye> doesn't ruby occupy a completely different niche though?
<johnjaye> in my head I file it under "dynamic languages with oo features and also xyz addons". in the case of ruby web related tasks
<johnjaye> idk if it was on purpose but ruby even shares keywords with python like def
<weaksauce> doubtful
<weaksauce> def is just a short way to write define
___nick___ has quit [Ping timeout: 240 seconds]
weyhmueller has quit [Read error: Connection reset by peer]
weyhmueller has joined #ruby
<cAMP> OK, moved the planet.rb into Mutonex repo, inc
<ox1eef_> def most likely comes from Lisp
c10l has quit [Ping timeout: 264 seconds]
Sampersand has joined #ruby
sam113101 has joined #ruby
<Sampersand> Hi all, question for you. Why doesn't this pass arguments to `foo` properly in Ruby 3.2.0?
<Sampersand> ```
<Sampersand> def foo(a:, b:) p [a, b] end
<Sampersand> [{a:1, b:2}, {a:3, b:4}].each { |**kwargs| foo(**kwargs) }
<Sampersand> ```
roadie` has joined #ruby
<leftylink> so you definitely don't want the first splat
<Sampersand> to solve it I need `.each { |kwargs| foo(**kwargs) }` . It seems related to `ruby2_keywords` but im not sure why `**splat `doesnt work
<Sampersand> it's also a bit weird since when you use a single argument in a block and are passed multiple positional arguments, that single argument is an array of them. Does this behaviour change with hashes?
roadie has quit [Ping timeout: 248 seconds]
<leftylink> pandabot rb [{a:1, b:2}.then { |**kw| kw }, {a:1, b:2}.then { |kw| kw }]
<pandabot> [{}, {:a=>1, :b=>2}] - https://carc.in/#/r/f358
<leftylink> okay in fact I can see this being related to the ruby 3 kwargs thing
<leftylink> because |**kwargs| says kwargs should be any kwargs the caller of the block passes in
<leftylink> and each would pass in {a:1, b:2}
<Sampersand> yeah exactly
<Sampersand> so maybe those are passed as positional arguments, and since no positional arguments are described it drops them
walez_ has joined #ruby
<Sampersand> Now for something entirely unrelated: How can I make a `GET` request to an arbitrary host with port? I know you can `Net::HTTP.get(URI("http://#{host}"))` (and also `https://`) but i dont see a way to do it to any arbitrary port. ( `Net::HTTP.get(URI("http://www.example.com:443"))` doesn't work, for example)
sam113101 has quit [Ping timeout: 240 seconds]
<ox1eef_> Use https:// if the port is 443.
<ox1eef_> Otherwise, Net::HTTP.new('host.com', 123)
sam113101 has joined #ruby
howdoi has joined #ruby
sam113101 has quit [Ping timeout: 248 seconds]
<Sampersand> ox1eef_: do you know if `Net::HTTP` instances are idempotent or not? ie can I reuse the same one withotu concern
CalculusCats has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
CalculusCats has joined #ruby
<ox1eef_> On the same thread, sure - no problem. Across threads, you might want to limit it to one instance per thread.
TomyWork has quit [Remote host closed the connection]
<Sampersand> cool
_ht has quit [Remote host closed the connection]
fercell has joined #ruby
cAMP has left #ruby [ta!]
cek has joined #ruby
walez_ has quit [Quit: Leaving]
mexen has quit []
Sampersand has quit [Quit: Client closed]
roadie` has quit [Ping timeout: 248 seconds]
sam113101 has joined #ruby
tomtmym has quit [Quit: Gone.]
infinityfye has quit [Quit: Leaving]
Sampersand has joined #ruby
cek has quit []
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
grenierm has joined #ruby
crueber_ has joined #ruby
roadie` has joined #ruby
crueber_ has quit [Quit: Leaving]
roadie` has quit [Ping timeout: 248 seconds]
<Sampersand> Is there a way to have ruby automatically `require` some files whenever it starts? Context: I'm debugging some server code locally, and I want to just have `binding.pry` always defined
roadie` has joined #ruby
plujon has joined #ruby
<plujon> Can the standard net/http module be used to parse a raw http request?
<plujon> request = Net::HTTP::read_raw(raw_http_request) # something like this
roadie` has quit [Ping timeout: 248 seconds]
<havenwood> plujon: With Net::HTTP you can `set_debug_output($stdout)` to get at the raw HTTP request.
<havenwood> I personally avoid Net::HTTP.
<havenwood> Or send the debug output elsewhere.
Thanzex3268 has quit [Quit: Ping timeout (120 seconds)]
<havenwood> I really favor the HTTP clients that support HTTP/2 these days. Particularly, Typhoeus, Async::HTTP, and HTTPX.
Thanzex3268 has joined #ruby
znpy has quit [Quit: Ping timeout (120 seconds)]
znpy has joined #ruby
<plujon> havenwood: Thanks, but I don't want to see a raw http request; I want to parse a raw http request into a ruby object.
grenierm has quit [Quit: Client closed]
<havenwood> plujon: What's the result you're looking for? Parsing into objects seems broad. Have an example result you're aiming for?
Sampersand has quit [Quit: Client closed]
roadie` has joined #ruby
roadie` has quit [Ping timeout: 248 seconds]
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
reset has quit [Ping timeout: 240 seconds]
sam113101 has quit [Remote host closed the connection]
sam113101 has joined #ruby