havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview1: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
<johnjaye> whatever this ruby on rails thing it doesn't seem that amazing. i had to literally go to a stackoverflow answer to figure out how to load it in the irb propmt
<johnjaye> *prompt
John_Ivan has quit [Ping timeout: 246 seconds]
eddof13 has joined #ruby
crespire has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
konsolebox has joined #ruby
<weaksauc_> johnjaye rails c
<weaksauc_> or `rails console`
<weaksauc_> it
<johnjaye> idk what that is. bash and irb don't recognize a rails command
<weaksauc_> well you have to have it installed as a gen
<weaksauc_> m*
<weaksauc_> and you should be in the context of a rails project
<weaksauc_> but it loads everything up as an irb shell
<weaksauc_> in the context of the project
<weaksauc_> do the rails getting started guide and you will see
<johnjaye> ok. i asked before because when i do help commands i see active_support listed
<ox1eef_> 'bundle exec rails c', or: ./bin/rails c
<johnjaye> i don't have /bin/rails or anything like that.
<johnjaye> i'm not sure how active_support got put into ruby. this is a debian-flavored system
<ox1eef_> 'bundle exec rails c' then, but I think there's the options of bin stubs too (eg ./bin/rails). Maybe not default.
<johnjaye> i get cannot locate gemfile or current bundle directory. is bundle like a package manager?
<ox1eef_> Have you run 'rails new my_app', and changed directory into 'my_app' ?
<johnjaye> that's the thing, i don't think i have rails installed at all. it seems to be a separate package.
<johnjaye> on debian ruby-rails. so idk why i have active_support listed from the regular ruby2.7 package
<ox1eef_> Yep. Bundler manages gem dependencies. And with Gemfile.lock, it makes sure the versions of gems used is always the same. Kind of a sandbox, because what's not in Gemfile.lock cannot be required.
<johnjaye> anyway it's moot since i don't want to develop with rails in particular. i just didn't understand why i had it but not the official package
<ox1eef_> I'd suggest not using apt for Ruby stuff.
<ox1eef_> It's usually dated, and butchered to pieces. Just a frustrating experience all round.
<johnjaye> meaning?
<johnjaye> ok. but how do i do it otherwise. some kind of bash script thing like rust does?
Sankalp has quit [Ping timeout: 246 seconds]
shokohsc5105 has joined #ruby
<ox1eef_> On my other computer I use FreeBSD, and their installation of Ruby is also butchered. So I basically compile it by hand, via my own port (https://github.com/0x1eef/ports/tree/main/freebsd/lang/ruby32-std). On this computer I use OpenBSD, and it has a normal Ruby, so I just use their package.
<ox1eef_> In your case, you can compile by hand or use a ruby version manager. (rbenv, ruby-install / chruby).
shokohsc510 has quit [Ping timeout: 244 seconds]
shokohsc5105 is now known as shokohsc510
<konsolebox> johnjaye: active_support can be used by non-rails gems too
<johnjaye> ok. i thought active support was synonymous with rails.
<johnjaye> i don't really know enough to grasp these subtleties.
<ox1eef_> Rails is a collection of gems. active record, active support, action mailer, etc.
<johnjaye> oh ok
<konsolebox> See loads of irresistible features it gives
<johnjaye> how do i view the gems i have available
<ox1eef_> A modular monolith :D
<ox1eef_> gem list
<ox1eef_> If you have active support but not rails, you are probably using another gem that brought in active support.
<johnjaye> as far as i know i just apt-get installed ruby
<ox1eef_> Every gem that says 'default:', that's part of Ruby but things like activesupport, concurrent-ruby, and more are something installed by 'gem install x'.
<johnjaye> i don't recall doing gem install anything
<johnjaye> maybe i did one time and forgot
Sankalp has joined #ruby
<johnjaye> it says i installed something called ruby-tty-command
<ox1eef_> Possible.
<johnjaye> my assumption was debian just installed active_support when you do ruby
<ox1eef_> Don't install gems as root though. Setup $GEM_HOME / $GEM_PATH if you didn't already.
<ox1eef_> I don't think so.
<konsolebox> GEM_HOME / GEM_PATH hacks are the reason to just avoid using system Ruby completely. It's rare for a distro to get its defaults done right and it has ti adapt with Rubygem's constant changes.
<johnjaye> i see
<leftylink> I would really hope activesupport wouldn't get installed by default. if I ask for Ruby to installed, I expect Ruby to get installed, not some unwanted gem that I didn't ask for
<johnjaye> hmm. i'm not sure exactly. my apt history doesn't show much. but then dpkg shows i do have a lot of gems installed. so my guess is it's the default
<johnjaye> if i get a chance to investigate later with a debian vm i can try
<konsolebox> johnjaye: Are those gems part of a package? They're likely dependencies called by other packages, unless you installed a gem in system install mode with `gem install`.
<konsolebox> I mean active_support surely can't be part of the core Ruby package. That certainly would be surprising.
Linux_Kerio has joined #ruby
swaggboi has joined #ruby
TheCatCollective has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
TheCatCollective has joined #ruby
TheCatCollective has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
TheCatCollective has joined #ruby
Linux_Kerio has quit [Quit: Konversation terminated!]
Vonter has quit [Ping timeout: 260 seconds]
TheCatCollective has quit [Remote host closed the connection]
Vonter has joined #ruby
teclator has joined #ruby
keypresser86 has quit []
keypresser86 has joined #ruby
konsolebox has quit [Ping timeout: 246 seconds]
konsolebox has joined #ruby
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
TheCatCollective has joined #ruby
victori has joined #ruby
teclator has quit [Ping timeout: 245 seconds]
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
szkl has quit [Quit: Connection closed for inactivity]
victori has joined #ruby
_ht has joined #ruby
duderonomy has quit [Remote host closed the connection]
m_antis has quit [Ping timeout: 246 seconds]
m_antis has joined #ruby
TheCatCollective has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
MarvelousWololo_ has joined #ruby
MarvelousWololo_ has quit [Read error: Connection reset by peer]
_ht has quit [Remote host closed the connection]
llua has quit [Quit: <Rudolph> shell code is what greycat reads to kids when he tucks them in]
llua has joined #ruby
TheCatCollective has joined #ruby
duderonomy has joined #ruby
brokkoli_origin has quit [Ping timeout: 246 seconds]
llua has quit [Quit: <Rudolph> shell code is what greycat reads to kids when he tucks them in]
llua has joined #ruby
scottgy has joined #ruby
pookie has joined #ruby
polishdu1 has joined #ruby
cognemo_ has joined #ruby
heartburn has quit [*.net *.split]
Manouchehri has quit [*.net *.split]
olus has quit [*.net *.split]
polishdub has quit [*.net *.split]
jess has quit [*.net *.split]
olspookishmagus has quit [*.net *.split]
cognemo has quit [*.net *.split]
scottg489 has quit [*.net *.split]
Liothen has quit [*.net *.split]
pjlsergeant__ has quit [*.net *.split]
Caius has quit [*.net *.split]
Manouchehri has joined #ruby
Caius has joined #ruby
teclator has joined #ruby
olus has joined #ruby
heartburn has joined #ruby
jess_ has joined #ruby
llua has quit [Quit: <Rudolph> shell code is what greycat reads to kids when he tucks them in]
m_antis has quit [Ping timeout: 245 seconds]
llua has joined #ruby
pjlsergeant__ has joined #ruby
Liothen has joined #ruby
vinc has quit [Quit: Lost terminal]
crespire has quit [Ping timeout: 246 seconds]
crespire has joined #ruby
konsolebox has quit [Ping timeout: 240 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
konsolebox has joined #ruby
jvalleroy has joined #ruby
jess_ is now known as jess
<cxl> Hi all, what is the right way to add months and years to Time.now? Doing it with ActiveSupport's `months` and `years` gives odd results since it uses seconds to make the calculation. Doing it with the seconds as in ActiveSupport gives: Time.now => 2023-08-08
<cxl> 10:55:09 +0200, but Time.now + 12 * 2629746 => 2024-08-07 16:44:21 +0200
<cxl> 2629746 is the number of seconds per month, as done in ActiveSupport.
jmcgnh has quit [Ping timeout: 260 seconds]
jmcgnh has joined #ruby
smp has quit [Ping timeout: 244 seconds]
smp has joined #ruby
Tempesta has quit [*.net *.split]
Tempesta has joined #ruby
jtperreault has quit [*.net *.split]
quintasan has quit [*.net *.split]
miah has quit [*.net *.split]
itok has quit [*.net *.split]
roger_rabbit has quit [*.net *.split]
GvJordan has quit [*.net *.split]
Bitflux has quit [*.net *.split]
thomas25 has quit [*.net *.split]
pandabot has quit [*.net *.split]
ccooke has quit [*.net *.split]
jposer has quit [*.net *.split]
Hobbyboy has quit [*.net *.split]
mooff has quit [*.net *.split]
JayDoubleu__ has quit [*.net *.split]
cuppajoeman has quit [*.net *.split]
Spitfire has quit [*.net *.split]
joto has quit [*.net *.split]
wakaflaka has quit [*.net *.split]
konsolebox has quit [Quit: -a- IRC for Android 2.1.60]
<ox1eef_> cxl: Do it from midnight. require 'date'; Date.today.to_time + seconds.
thomas25 has joined #ruby
miah has joined #ruby
ccooke has joined #ruby
itok has joined #ruby
quintasan has joined #ruby
jposer has joined #ruby
cuppajoeman has joined #ruby
mooff has joined #ruby
JayDoubleu__ has joined #ruby
Spitfire has joined #ruby
Bitflux has joined #ruby
Hobbyboy has joined #ruby
wakaflaka has joined #ruby
roger_rabbit has joined #ruby
GvJordan has joined #ruby
pandabot has joined #ruby
joto has joined #ruby
jtperreault has joined #ruby
<ox1eef_> If you have ActiveSupport available, you should be able to use '.change' though. Time.current.change(month: X, year: Y).
itok has quit [Ping timeout: 258 seconds]
<ox1eef_> Time.now.beginning_of_day + 2.months - also an option with ActiveSupport.
itok has joined #ruby
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 245 seconds]
gr33n7007h has joined #ruby
konsolebox has joined #ruby
desnudopenguino1 has joined #ruby
konsolebox has quit [Client Quit]
desnudopenguino has quit [Ping timeout: 260 seconds]
desnudopenguino1 is now known as desnudopenguino
Sankalp has quit [Ping timeout: 240 seconds]
brokkoli_origin has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 260 seconds]
desnudopenguino1 is now known as desnudopenguino
Sankalp has joined #ruby
some14u has joined #ruby
some14u has quit [Client Quit]
dalan03822 has quit [Quit: dalan03822]
dalan03822 has joined #ruby
donofrio has joined #ruby
user23 has joined #ruby
Sankalp has quit [Ping timeout: 256 seconds]
John_Ivan has joined #ruby
shokohsc5100 has joined #ruby
shokohsc510 has quit [Ping timeout: 260 seconds]
shokohsc5100 is now known as shokohsc510
Sankalp has joined #ruby
nkm has joined #ruby
m_antis has joined #ruby
<johnjaye> hmm, in ruby how would I generate a list given an expression
<johnjaye> something like that syntax in python where it's [ i+j for i in 1 to 10 and j in 1 to 10]
<johnjaye> then it gives you a list or something with all combinations
nkm has quit [Quit: Client closed]
<ox1eef_> A range ? (1..10).to_a
<johnjaye> yes but python has something like if you want all combinations of integers
<adam12> johnjaye: what's the output of that?
<adam12> is it like a permutation?
<johnjaye> say (1,1), (1,2), (1,3), (2,1), (2,2),(2,3), etc
<johnjaye> you would say [ (i,j) for i in range(3)]
<johnjaye> not sure the exact syntax.
<johnjaye> yes it's a permutation
<adam12> [*1..10].permutation(2).to_a
<johnjaye> hmm, interesting.
<johnjaye> now i'm stuck
<johnjaye> i tried putting a for loop on the irb prompt and it doesn't execute
<johnjaye> x=[1,2,3,4,5]; for i in x do puts i end
<ox1eef_> Use .each instead. for is more or less never used in Ruby.
FetidToot has quit [Ping timeout: 245 seconds]
<johnjaye> hmm, it's fine if i put it in a file
<ox1eef_> for i in [1,2,3,4,5]; puts i; end
<ox1eef_> But you're going against the grain by using for.
<johnjaye> ok.
<johnjaye> is each guaranteed to go in order
<ox1eef_> Also, after that, type 'puts i', and you'll see 5. Most the time that's not desirable.
<johnjaye> although i guess a better question is, how do you simulate a for loop with each
<johnjaye> for example what if i want to stop at 3
<ox1eef_> [1,2,3,4,5].each { |i| break if i == 3 }
<johnjaye> would i just use a break?
<ox1eef_> Yep
<johnjaye> ah i see.
<johnjaye> now that i think about it i guess the main idea of a for loop is that you control the conditions of it
<johnjaye> i.e. you give it start conditions, a next condition, and an end condition
<johnjaye> it's sort of a more convenient while loop
<ox1eef_> Sure, in languages like JS and C. In Ruby it is a rare breed that almost no one uses.
xuochi has joined #ruby
<johnjaye> are while and until also rare?
<ox1eef_> Even JS has forEach these days.
<adam12> #upto might be that, in some ways.
FetidToot has joined #ruby
<ox1eef_> while is more common, until exists but like unless, I usually avoid it.
<adam12> or #step
<johnjaye> what does the # mean
<adam12> johnjaye: It references an instance method
<johnjaye> ok, makes sense
<adam12> #step is an instance method on Numeric (but might be on String and other classes, which is why I left off the class)
<adam12> More specific might be Numeric#step
<adam12> 1.step(10, by: 3)
<johnjaye> by the way i checked my path. it says i have gem active support in ~/.local/share/gem/ruby
<johnjaye> i don't have active_support in the /usr/lib... gem dir. so somehow I must have installed it. not sure how
FetidToot5 has joined #ruby
FetidToot has quit [Ping timeout: 260 seconds]
FetidToot5 is now known as FetidToot
hrberg has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
hrberg has joined #ruby
smp has quit [Ping timeout: 240 seconds]
smp has joined #ruby
TomyWork has joined #ruby
xuochi has quit [Quit: leaving]
MarvelousWololo has joined #ruby
MarvelousWololo has quit [Ping timeout: 256 seconds]
eddof13 has joined #ruby
xuochi has joined #ruby
graywolf has joined #ruby
_ht has joined #ruby
keypresser86 has quit []
desnudopenguino has quit [Ping timeout: 260 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
ollysmith has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
TomyWork has quit [Quit: Leaving]
keypresser86 has joined #ruby
Vonter has quit [Ping timeout: 245 seconds]
teclator has quit [Ping timeout: 240 seconds]
mexen has joined #ruby
user23 has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
keypresser86 has quit [Ping timeout: 256 seconds]
xuochi has quit [Quit: leaving]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
mexen has quit []
FetidToot6 has joined #ruby
_ht has quit [Quit: _ht]
FetidToot has quit [Ping timeout: 245 seconds]
FetidToot6 is now known as FetidToot
FetidToot1 has joined #ruby
FetidToot has quit [Ping timeout: 256 seconds]
FetidToot1 is now known as FetidToot
FetidToot7 has joined #ruby
FetidToot has quit [Ping timeout: 256 seconds]
FetidToot7 is now known as FetidToot
crespire1 has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1!crespire@user/crespire))]
crespire has joined #ruby
FetidToot7 has joined #ruby
FetidToot has quit [Ping timeout: 246 seconds]
FetidToot7 is now known as FetidToot
crespire1 has quit [Ping timeout: 256 seconds]
crespire has quit [Ping timeout: 246 seconds]
crespire has joined #ruby
FetidToot4 has joined #ruby
FetidToot has quit [Ping timeout: 256 seconds]
FetidToot4 is now known as FetidToot
crespire1 has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1!~crespire@user/crespire))]
FetidToot6 has joined #ruby
FetidToot has quit [Ping timeout: 246 seconds]
FetidToot6 is now known as FetidToot
MarvelousWololo has joined #ruby
FetidToot4 has joined #ruby
FetidToot has quit [Ping timeout: 246 seconds]
FetidToot4 is now known as FetidToot
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ollysmith has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
graywolf has quit [Quit: WeeChat 4.0.2]
desnudopenguino has quit [Quit: desnudopenguino]
desnudopenguino has joined #ruby
eddof13 has joined #ruby
Bish has quit [Ping timeout: 246 seconds]
gr33n7007h has quit [Ping timeout: 256 seconds]
Bish has joined #ruby
gr33n7007h has joined #ruby
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
brw6 is now known as brw
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby