adam12 changed the topic of #ruby to: Ruby 3.3.1, 3.2.4, 3.1.5 https://www.ruby-lang.org | Logs https://libera.irclog.whitequark.org/ruby
sagax has quit [Ping timeout: 240 seconds]
donofrio_ has joined #ruby
Pixi has quit [Ping timeout: 256 seconds]
brw has quit [Remote host closed the connection]
donofrio__ has quit [Ping timeout: 240 seconds]
brw has joined #ruby
brw has quit [Remote host closed the connection]
brw has joined #ruby
Pixi has joined #ruby
factor has quit [Ping timeout: 272 seconds]
<leftylink> hmm. most of the Ruby I write these days is code that helps me calculate something for a game. like the possible ways to achieve an objective, or how to maximise a certain value
<leftylink> like, you'll recall that a few weeks back I wrote code that was looking for a prime < 100 that is the sum of six primes
<leftylink> you guessed it, that was for a game
<leftylink> I don't even remember what game anymore
a7ol has joined #ruby
a7ol has quit [Client Quit]
Paris has joined #ruby
desnudopenguino has quit [Ping timeout: 268 seconds]
Paris has quit [Changing host]
Paris has joined #ruby
desnudopenguino has joined #ruby
Paris has quit [Quit: quit]
Paris has joined #ruby
Paris has quit [Remote host closed the connection]
Paris has joined #ruby
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Paris has quit [Quit: quit]
factor has joined #ruby
poems has quit [Quit: Leaving]
passbe has quit [Ping timeout: 272 seconds]
passbe has joined #ruby
passbe has quit [Ping timeout: 264 seconds]
passbe has joined #ruby
cappy has quit [Quit: Leaving]
konsolebox has joined #ruby
konsolebox_ has joined #ruby
konsolebox has quit [Ping timeout: 260 seconds]
passbe has quit [Ping timeout: 272 seconds]
passbe has joined #ruby
passbe has quit [Ping timeout: 260 seconds]
brokkoli_origina has quit [Remote host closed the connection]
passbe has joined #ruby
brokkoli_origina has joined #ruby
passbe has quit [Quit: Ping timeout (120 seconds)]
passbe has joined #ruby
passbe has quit [Ping timeout: 255 seconds]
passbe has joined #ruby
passbe7 has joined #ruby
passbe has quit [Ping timeout: 260 seconds]
passbe7 is now known as passbe
grenierm has joined #ruby
passbe has quit [Ping timeout: 255 seconds]
passbe has joined #ruby
<konsolebox_> adam12, mooff: If you remember the "ruby interpreting arguments in a shebang" issue I had lately, I decided to keep the name rubyexec. It's useful that rubyexec is also usable to scripts containing special options in the shebang.
passbe has quit [Quit: Ping timeout (120 seconds)]
BayouGuru has joined #ruby
mkoncek has joined #ruby
desnudopenguino has quit [Quit: desnudopenguino]
TomyWork has joined #ruby
Linux_Kerio has joined #ruby
grenierm has quit [Quit: Client closed]
Paris has joined #ruby
Paris has quit [Changing host]
Paris has joined #ruby
xdminsy has quit [Quit: Konversation terminated!]
xdminsy has joined #ruby
jaredce has joined #ruby
sagax has joined #ruby
xdminsy has quit [Quit: Konversation terminated!]
donofrio has joined #ruby
donofrio_ has quit [Ping timeout: 252 seconds]
benedick86 has joined #ruby
benedick86 has quit [Quit: benedick86]
Inline has joined #ruby
CrazyEddy has quit [Quit: Reconnecting]
CrazyEddy has joined #ruby
CrazyEddy has quit [Client Quit]
CrazyEddy has joined #ruby
CrazyEddy has quit [Remote host closed the connection]
passbe has joined #ruby
xdminsy has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 272 seconds]
rvalue- is now known as rvalue
Paris has quit [Ping timeout: 268 seconds]
osc4rpt has joined #ruby
CrazyEddy has joined #ruby
jaredce has quit [Ping timeout: 252 seconds]
passbe has quit [Quit: Ping timeout (120 seconds)]
jaredce has joined #ruby
jaredce has quit [Ping timeout: 272 seconds]
jaredce has joined #ruby
<adam12> konsolebox_: You worked around your issue then?
<konsolebox_> adam12: Yes the option has to be placed after the implementation names.
passbe has joined #ruby
<adam12> konsolebox_: Ah.
passbe has quit [Quit: Ping timeout (120 seconds)]
kwilczynski has joined #ruby
cxl has quit [Ping timeout: 260 seconds]
cappy has joined #ruby
trillion_exabyte has quit [Ping timeout: 256 seconds]
trillion_exabyte has joined #ruby
desnudopenguino has joined #ruby
Linux_Kerio has quit [Ping timeout: 268 seconds]
kwilczynski has quit []
Paris has joined #ruby
Paris has quit [Changing host]
Paris has joined #ruby
cxl has joined #ruby
Linux_Kerio has joined #ruby
orbyt_v10 has joined #ruby
<TomyWork> what does one use these days in order to access a mariadb database (and, ideally, also mysql databases)
<TomyWork> https://mariadb.com/kb/en/ruby/ this says to use the mysql gem. I'm trying to build that, but I'm failing...
<TomyWork> I'm gonna try some more :)
<TomyWork> basically the steps I put in my build script that worked on my old machine a year ago no longer work
<TomyWork> but I also updated the gem from 2.8.1 to 2.9.1, both of which are older than this entire project, so idk what's going on
<TomyWork> oops, figured it out. I was previously using mysql2, not mysql...
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> TomyWork: Sequel for everything.
<adam12> TomyWork: You'll still need an adapter for mysql/mariadb. Sequel supports mysql2, mysql, and mysql-ruby.
<adam12> ruby-mysql rather
<TomyWork> oh i thought you meant mysql2 is a sequel for mysql :D
<adam12> You could also try trilogy which is from Github. I've never used it.
<TomyWork> nah I'm not gonna do a major architectural overhault right now
<adam12> If you're having an issue building mysql gem, likely can't find dev headers.
<adam12> Share that error and maybe we can help with that.
jaredce has quit [Ping timeout: 268 seconds]
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
<TomyWork> I'm not gonna debug a gem that's been abandoned 11 years ago
Linux_Kerio has quit [Read error: Connection reset by peer]
<TomyWork> that i didn't even mean to use
<adam12> I'd just use mysql2 then
<TomyWork> I meant to use mysql2
user71 has joined #ruby
<TomyWork> I'm still chewing on the problem I had yesterday. I installed the prometheus-client gem but I can't "require 'prometheus/middleware/collector'". I get "LoadError: cannot load such file -- prometheus/middleware/collector"
<TomyWork> I'm doing this in my classic sinatra application, not in config.ru
<TomyWork> although upgrading sinatra to 4.0.0 required me to add the rackup gem as well, so I guess sinatra is based on rackup, too, now?
<TomyWork> the error I got without it was 'Sinatra could not start, the "rackup" gem was not found!'
<adam12> TomyWork: rack 2 to 3 separated rackup from rack.
<adam12> TomyWork: So now you need rack and rackup gems if you want to use rackup.
<adam12> Are you using Gemfile / bundler?
<TomyWork> I dont know if i want eithe rack or rackup. I want to add a prometheus metrics endpoint. prometheus middleware from the prometheus-client gem seemed like the easiest way
<adam12> TomyWork: How do you run your app?
<adam12> And do you just `require "sinatra"` at the top?
<TomyWork> bundle exec ./app.rb and yes
<TomyWork> "== Sinatra (v4.0.0) has taken the stage on 54321 for development with backup from WEBrick" <-- shouldnt it say something about rack if it's using rack?
<adam12> You added prometheus-client to your Gemfile?
<TomyWork> oh i get it, rack is a framework and you can use any application server with it, including webrick
<adam12> Rack is just the translation layer between Sinatra and WEBrick (and others)
<adam12> Yeah
<adam12> A long time ago, every web framework had to build support for each web application server
<TomyWork> yes I added prometheus-client to my Gemfile
<adam12> Then leah2 made Rack, which just unifies the interface.
<TomyWork> neat
<adam12> I'm surprised you're getting the error about no such file then.
<TomyWork> me too
<TomyWork> gem 'prometheus-client', '~> 0.4.2'
<TomyWork> oof why is this old version the first result on google
<adam12> That version is old
<adam12> Ooh. I missed it. Yes. Current is like 4.x
<TomyWork> yeah 4.4.2
<TomyWork> yay, works now
<TomyWork> just one problem: no metrics :D
cappy has quit [Quit: Leaving]
<TomyWork> oh nm, that was just because /metrics was literally the first request
<TomyWork> ok, now I'll just deploy this, throw a prometheus annotation on it and call it a day. grafana dashboard some other day :)
<TomyWork> thanks a lot for the help :)
<adam12> Nice.
georgemp has quit [Quit: ZNC - https://znc.in]
georgemp has joined #ruby
georgemp has quit [Remote host closed the connection]
Paris has quit [Ping timeout: 252 seconds]
georgemp has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
TomyWork has quit [Quit: Leaving]
BayouGuru has quit [Quit: Quitting...Bye!]
BayouGuru has joined #ruby
Inline has quit [Quit: Leaving]
c10l has quit [Ping timeout: 264 seconds]
c10l has joined #ruby
orbyt_v10 has joined #ruby
BayouGuru has quit [Quit: Quitting...Bye!]
vanfanel64 has joined #ruby
Pixi` has joined #ruby
<vanfanel64> eval: x = 0; if (x) then puts "T"; else puts "F"; end
<vanfanel64> ruby[bot]: eval: x = 0; if (x) then puts "T"; else puts "F"; end
<vanfanel64> 1) How to eval code in here, and 2) Why does that print T
Pixi has quit [Ping timeout: 256 seconds]
dalan03822833508 has joined #ruby
dalan03822833508 has quit [Client Quit]
dalan03822833508 has joined #ruby
joako_ has quit [Quit: quit]
srbaker has quit [Ping timeout: 272 seconds]
joako has joined #ruby
user71 has quit [Quit: Leaving]
<adam12> vanfanel64: >> <some ruby>
<adam12> >> x = 0; if (x) then puts "T"; else puts "F"; end
<ruby[bot]> adam12: # => T ...check link for more (https://carc.in/#/r/gucs)
<adam12> In Ruby, anything other than nil and false are "truthy".
<adam12> So 0 is not false(y). It's an instance of Fixnum.
<vanfanel64> >> x = 0; if (x.to_b) then puts "T"; else puts "F"; end
<ruby[bot]> vanfanel64: # => undefined method `to_b' for 0:Integer ...check link for more (https://carc.in/#/r/guct)
<adam12> >> x = 0; if x.zero? then puts "T"; else puts "F"; end
<ruby[bot]> adam12: # => T ...check link for more (https://carc.in/#/r/gucu)
<adam12> Is 0 an exit status code?
<vanfanel64> >> x = 0; if ![false, 0, "0", ""].include? x; puts "T"; else puts "F"; end
<ruby[bot]> vanfanel64: # => F ...check link for more (https://carc.in/#/r/gucv)
<vanfanel64> >> x = 1; if ![false, 0, "0", ""].include? x; puts "T"; else puts "F"; end
<ruby[bot]> vanfanel64: # => T ...check link for more (https://carc.in/#/r/gucw)
<vanfanel64> >> x = ""; if ![false, 0, "0", ""].include? x; puts "T"; else puts "F"; end
<vanfanel64> >> x = " "; if ![false, 0, "0", ""].include? x; puts "T"; else puts "F"; end
<vanfanel64> adam12, no just a test to see how 0 "0", "" can be treated as false like in many other scripting languges
<vanfanel64> I think I broke the bot
<adam12> vanfanel64: I'd just define a Boolean method that does the coercion for you. You can define it on Kernel and it would be everywhere. It's kinda faux-pas because you're clobbering the global namespace but it might work for you.
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<vanfanel64> adam12, thanks, though I am not sure where/what is being clobbered though. Do you mean just be declaring x? That was just for a simple test
Paris has joined #ruby
<weaksauce> vanfanel64 what are you actually trying to do?
<weaksauce> in ruby there are only two falsey values ... nil and false.
osc4rpt has quit [Ping timeout: 246 seconds]
osc4rpt has joined #ruby
Paris has quit [Quit: quit]
donofrio_ has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
donofrio has quit [Ping timeout: 256 seconds]
orbyt_v10 has joined #ruby
Paris has joined #ruby
Paris has quit [Changing host]
Paris has joined #ruby
teardown has quit [Ping timeout: 260 seconds]
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_v10 has joined #ruby