pwnd_sfw has quit [Read error: Connection reset by peer]
pwnd_sfw4 is now known as pwnd_sfw
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 252 seconds]
tree has joined #ruby
gearnode has quit [Ping timeout: 244 seconds]
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 252 seconds]
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 252 seconds]
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
xuochi has quit [Read error: Connection reset by peer]
xuochi has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 252 seconds]
swaggboi has quit [Remote host closed the connection]
postmodern has joined #ruby
swaggboi has joined #ruby
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 264 seconds]
reset has joined #ruby
jhass[m] has quit [Remote host closed the connection]
jhass[m] has joined #ruby
postmodern has quit [Quit: Leaving]
jmcgnh has quit [Ping timeout: 252 seconds]
jmcgnh has joined #ruby
Guest65 has joined #ruby
arestifo has joined #ruby
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 272 seconds]
Guest65 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gearnode has joined #ruby
Bounga has joined #ruby
podge has joined #ruby
gr33n7007h has quit [Ping timeout: 244 seconds]
Qchmqs has joined #ruby
Garb0 has joined #ruby
jhawthorn has quit [Ping timeout: 244 seconds]
gr33n7007h has joined #ruby
jhawthorn has joined #ruby
Garb0 has quit [Quit: Garb0]
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 244 seconds]
gr33n7001 is now known as gr33n7007h
<rapha>
jhass: re your ruby setup on arch ... RUBIES=(/opt/ruby* $HOME/.rubies/*) ... when echo'ing $RUBIES, only the ones in /opt show up ... i've never seen that kind of bash syntax before; how is it intended to work?
<jhass[m]>
it might be I only tested this on zsh, I don't remember. But strange. ls $HOME/.rubies/* does list stuff?
<gr33n7007h>
rapha: echo "${RUBIES[@]}"
<rapha>
gr33n7007h: doesn't change anything
<rapha>
jhass[m]: yes it does ... 3.0
<jhass[m]>
and if you just do RUBIES=($HOME/.rubies*) does it include it then too?
<jhass[m]>
sorry, /* of course
<rapha>
ah, yes, in zsh it works
<jhass[m]>
:/
<jhass[m]>
RUBIES=(/opt/ruby*); RUBIES+=($HOME/.rubies/*) should work then
<rapha>
the first one always works
<rapha>
nope
<rapha>
only the first one still :P
<rapha>
very funky
<gr33n7007h>
rapha: what does `declare -p RUBIES` show
<jhass[m]>
Does RUBIES=(/opt/ruby2.5); RUBIES+=($HOME/.rubies/3.0) show both?
<rapha>
gr33n7007h: declare -a RUBIES=([0]="/opt/ruby*" [1]="/home/jrs/.rubies/3.0")
<rapha>
ah!
<rapha>
jhass[m]: doing that and then gr33n7007h's echo "${RUBIES[@]}" works
<rapha>
the depths of bash...
<rapha>
ah and i must have messed something up in between
<rapha>
your original line from the gist and then gr33n7007h's echo "${RUBIES[@]}" _does_ work fine
<jhass[m]>
haha, phew, I thought I was loosing sanity :D
<jhass[m]>
btw unfortunately the ruby2.7 package in community changed packaging stlye, so you gotta symlink to .rubies for that one too
<rapha>
jhass[m]: buuuut ruby2.7-bundler is not in AUR anymore it seems :-/
<rapha>
ah, that too, i see
<jhass[m]>
well it was in community for a while, dunno what happened
<rapha>
hmm and jruby is /opt/jruby, which won't be caught by /opt/ruby*
<jhass[m]>
you can just add it to RUBIES
<rapha>
yeah
<rapha>
just wanted to mention in case you want to update the gist
<rapha>
what won't work for me though is to create packages for unpackaged gems ... the workload would simply be too high, especially in the case of just wanted to try out things.
<rapha>
(or even to go hunting for already packaged ones...)
<jhass[m]>
I just use bundler in these cases. chruby points your GEM_HOME into your HOME so it also isn't too bad to just gem install stuff
<rapha>
oh, and ouch: "chruby_use 3.0" gives "chruby: 3.0/bin/ruby not executable" (but it is )
<nakilon>
btw, something has to be done with the fact that people are putting ./vendor to git repos
<nakilon>
github is just flooded with it
<jhass[m]>
yeah :(
<nakilon>
my username gets into thousands of repos just because it's in the CHANGELOG.txt
<jhass[m]>
rapha: does adding /opt/jruby to RUBIES actually work? I see it does not provide a /opt/jruby/bin/ruby
<rapha>
true; it doesn't
<rapha>
but chruby is jruby-aware ... perhaps a symlink will suffice
<jhass[m]>
then you wanna go with the symlink to .rubies approach for that one too
<rapha>
yeah, that works
<rapha>
one minor gripe still left: `chruby` lists "2.7" and "3.0" but "ruby2.6" ... `chruby 2.6` works fine though
<rapha>
for now i'm happy :) ... thanks again for the write-up!
<jhass[m]>
yeah it just lists the folder names, but does a substring match when selecting
<jhass[m]>
gladly :)
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass[m]>
pro-tip, albeit I recommend it only for exceptional cases: If you need a specific patch release you can just ruby-install it, as it goes into .rubies too it'll just work
<jhass[m]>
if you want to make the names consistent you can just change them in .rubies I guess
<rapha>
very pro ... so far i've always been perfectly happy with the latest point release :P
Garb0 has joined #ruby
aeris has joined #ruby
arestifo has joined #ruby
arestifo has quit [Client Quit]
Garb0 has quit [Quit: Garb0]
<xuochi>
Y'all are spoiled. Coming from C and Java and still learning Ruby, I feel like I've been drinking RC Cola my whole life and finally got a Coke.
bastienleonard has joined #ruby
Qchmqs has quit [Ping timeout: 244 seconds]
<aesthetikx>
thats a good analogy xuochi
<aesthetikx>
what are you working on to learn
arestifo has joined #ruby
jetchisel has quit [Ping timeout: 264 seconds]
<xuochi>
So far, I am just patiently working through a book on the language as I've had zero exposure to it previously. The particular project is a company-internal website that will automate a lot of cloud infrastructure stuff.
<xuochi>
Ruby has more first party APIs than anything I've ever seen, so it's kind of the language of choice in my mind.
Qchmqs has joined #ruby
bastienleonard has quit [Ping timeout: 245 seconds]
pgib has quit [Ping timeout: 244 seconds]
dorian_ is now known as dorian
Garb0 has joined #ruby
<EdwardIII>
xuochi: yeah ruby stdlib is nice imo. especially if you've ever had experince with JS :)
<EdwardIII>
xuochi: is your system a bit like chef?
gr33n7007h has quit [Ping timeout: 272 seconds]
chonkbit has joined #ruby
<xuochi>
In this case no. I will be tying multiple SaaS APIs together for a non-profit organization in a dead simple way for the end users of the application.
<xuochi>
At the moment, I have something build in a mix of Bash and Java, and it's just... ugly.
bastienleonard has joined #ruby
<EdwardIII>
ah ha
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arestifo has joined #ruby
Qchmqs has quit [Ping timeout: 244 seconds]
jetchisel has joined #ruby
bastienleonard has quit [Quit: WeeChat 3.1]
Bounga has quit [Ping timeout: 245 seconds]
Garb0 has quit [Quit: Garb0]
bastienleonard has joined #ruby
Garb0 has joined #ruby
drn has quit [Ping timeout: 244 seconds]
Guest0 has joined #ruby
<Guest0>
how do I do this? Time::new(1, 1, 1, 7, 30) + Time::new(1, 1, 1, 0, 45) I want to add 45 minutes to 7 hours and 30 minutes
<Guest0>
like how do I add time conveniently?
<Guest0>
in vanilla Ruby
Garb00 has joined #ruby
<balo>
7.5 * 60 * 60 + 0.5 * 60 ? :D
<Guest0>
I wish there was a nicer way
<balo>
what is the context?
<ccooke>
Guest0: An issue there is that the Time class in Ruby is for concrete times. Time.new(1,1,1,7,30) doesn't create a "severn and a half hours" object, it creates "07:30 on the 1st of the 1st, 1AD" effectively
<balo>
(my math was wrong above, missing *60 but you get the idea)
<ccooke>
Guest0: However, you can just add to time objects. So "Time.now + (45*60)" will add 45 minutes to the time object returned by Time.now
<leftylink>
indeed, as you can see, Time does support + but it does need to be numeric
<ccooke>
Guest0: Time.at(seconds)
<ccooke>
(assuming you meant unix time)
<Guest0>
ah I got it now
<Guest0>
I still use IRB to this day for stuff like this and as a calculator
<nakilon>
that's what computers are for
<leftylink>
same. I now wonder whether it's because it is the shortest repl name I have installed, or other reason
<Guest0>
leftylink: for me it's mostly because it's a habit
<leftylink>
for example, if I instead preferred Python over Ruby, would I instead use python, even though irb is shorter? then name length has nothing to do with it and it's because of language pref
<Guest0>
but also because stuff is quick to do in Ruby
<nakilon>
you won't be able to exit python so easily
<nakilon>
you'd type exit
<nakilon>
read a ton of error message text
<Guest0>
that's a good point
<nakilon>
then type exit()
<leftylink>
both of them accept control-d so it'd usually be fine
<Guest0>
for me it takes some time to think of ctrl+d
<Guest0>
or ctrl+z even
<xuochi>
Guest0: well, the easiest thing to do is to extend the integer class, and you create minutes, hours, days, years via def minutes self * 60
<xuochi>
then you can do like Time.now + 20.minutes
<Guest0>
yeah the problem is that I have to do that each time
<Guest0>
I can only rely on defaults
<xuochi>
the more you use computers and different systems, the more things like ctl+d become muscle reflexes
<Guest0>
I suppose I don't really use cmd programs that don't let me exit with ctrl+c or esc
<xuochi>
even most terminal emulators accept ctl+d as exit
<xuochi>
most telnet implementations too
<xuochi>
and most repl implementations
<xuochi>
and .. well, yeah
<balo>
Guest0: you can add extra code to ~/.irbrc
<Guest0>
that sounds like a good solution but if I ever reinstall IRB I will be confused about why I can no longer do 999.hours
<balo>
if you go to a random server or you don't save your dotfiles yeah
<xuochi>
You could just put your dot files in a git repo, and then just clone the repo on any machine you use.
<Guest0>
hmm yeah I've seen people do that
<xuochi>
Guest0: Time.local(2021, 06) will generate 2021-06-01 00:00:00 in whatever your system's local time is, and you can specify the day, hour, min, and second too
<xuochi>
That will create a time object for you
<xuochi>
You can also use Time.gm or Time.utc
<Guest0>
right
<nakilon>
any ruby gem for image skeletonizarion?
reset has quit [Quit: reset]
<xuochi>
If you want the time in seconds, which you mentioned, you can do Time.now.to_i, and to go back you can use Time.at(seconds)
<nakilon>
any gem for fitting the line along the array of dots? to make the ax^3+bx^2+cx+d=0 approximation
<nakilon>
maybe ^4
Garb0 has joined #ruby
unmanbearpig has joined #ruby
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xuochi>
Guest0: I forgot, there is a gem that you might like for time stuff too, but you were asking for something that was "just Ruby". Chronic gem let's you do things with time in a more English-language way.
<Guest0>
I also heard of ActiveSupport
Garb0 has quit [Ping timeout: 252 seconds]
chonkbit has quit [Ping timeout: 252 seconds]
pwnd_sfw has quit [Read error: Connection reset by peer]
pwnd_sfw has joined #ruby
postmodern has joined #ruby
Guest0 has quit [Quit: Connection closed]
Qchmqs has quit [Ping timeout: 244 seconds]
<xuochi>
why does ''.methods.length have a length of 188? it's nothing right?
swaggboi has quit [Quit: C-x C-c]
<jhass>
sorry, I don't get the question
<xuochi>
so in IRB, if I do ''.methods.length, it returns 188
<jhass>
so?
<xuochi>
I just don't understand why since '' is closing on nothing
<jhass>
what do you think .methods returns, what kind of things?
<xuochi>
methods within an object, but what object is referenced by no name?
<jhass>
not of "an object", of "the object" it's called on
<jhass>
'' here is an instance of String
<jhass>
so it returns all of String's instance_methods
<xuochi>
ah okay
<xuochi>
that makes more sense
swaggboi has joined #ruby
<xuochi>
So, yeah. I was just experimenting with things. It's like IRB can be a reference for Ruby in some respects... cuz you can just do p "".methods
<xuochi>
and stuff like that
<xuochi>
the more I learn with Ruby, the more I like Ruby.
<jhass>
:)
<jhass>
?pry
* jhass
kicks ruby[bot]
<xuochi>
It's like eating potato chips, you eat one and then... the whole bag.
<ccooke>
xuochi: Object.methods.sort is in my muscle memory. But Pry is better
ruby[bot] has joined #ruby
<jhass>
?pry
<jhass>
mmh
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (http://pry.github.io/): gem install pry pry-doc
<xuochi>
O.O
<xuochi>
one of the things that I appreciate about C is that the language can be memorized; like the entire thing can fit in the head of the programmer and not be an issue. of course, this means that you have to "roll your own" or you have to find a 3rd party lib for everything. Ruby, otoh, provides easy ways to get information about things, and it makes it easy to use a larger more helpful language.
<jhass>
ack, I'm not actually a fan of all the aliases though
<jhass>
like .size & .length, .reduce and .inject, .select and .find_all and so on
<weaksauce>
well inject is just a bad name
<aesthetikx>
would you support a move to deprecate some of the aliases? or, do you think they are fine to keep around
<aesthetikx>
the start_with starts_with thing is problematic although that is rails specific, as is the size / length / count scenario