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
Guest19 has joined #ruby
<Guest19> hi
Guest19 has quit [Client Quit]
desnudopenguino1 has joined #ruby
nikkys has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
markong has quit [Ping timeout: 245 seconds]
caedmon has joined #ruby
m_antis has joined #ruby
gonix has joined #ruby
gonix has quit [Ping timeout: 260 seconds]
caedmon has quit [Ping timeout: 246 seconds]
diagnostics0 has joined #ruby
splud has quit [Ping timeout: 245 seconds]
diagnostics0 has quit [Remote host closed the connection]
caedmon has joined #ruby
MalusVulgaris has joined #ruby
Linux_Kerio has joined #ruby
<mooff> hightower3: check out gem2deb
goldfish has quit [Ping timeout: 252 seconds]
caedmon has quit [Ping timeout: 245 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 245 seconds]
Sankalp- is now known as Sankalp
splud has joined #ruby
c10l has quit [Ping timeout: 245 seconds]
duderonomy has joined #ruby
gr33n7007h has quit [Quit: WeeChat 4.0.1]
gr33n7007h has joined #ruby
keypresser86 has quit []
MalusVulgaris1 has joined #ruby
MalusVulgaris has quit [Ping timeout: 246 seconds]
MalusVulgaris1 is now known as MalusVulgaris
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has quit [Quit: WeeChat 4.0.1]
duderonomy has joined #ruby
caedmon has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
Linux_Kerio has quit [Ping timeout: 250 seconds]
caedmon has quit [Read error: Connection reset by peer]
reset has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
MalusVulgaris has quit [Ping timeout: 246 seconds]
Linux_Kerio has joined #ruby
grenierm has joined #ruby
Golcon has joined #ruby
roadie has joined #ruby
roadie has quit [Client Quit]
Golcon has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
Vonter has quit [Read error: Connection reset by peer]
Vonter has joined #ruby
<lester29> do you recommend learning ruby together with c or first master ruby before touching any other language?
grenierm has quit [Ping timeout: 246 seconds]
_ht has joined #ruby
roadie has joined #ruby
<sarna> lester29: both together would be tough, they're kinda of different worlds
<sarna> are you new to programming?
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
Tempesta has quit [Quit: See ya!]
sagax has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
podge has joined #ruby
patrick has quit [Killed (NickServ (GHOST command used by podge!~patrick@fsf/member/patrick))]
patrick has joined #ruby
havenwood has quit [Quit: Ping timeout (120 seconds)]
havenwood has joined #ruby
<lester29> sarna: yes
<sarna> lester29: then it's best to stick to one language until you're comfortable with it. ruby is a good choice :)
<sarna> you can dabble in C later if you decide so, it'll be less frustrating than trying to learn both at once
<lester29> is it okay to learn ruby together with emacs and its elisp language?
<lester29> i want to do ruby stuff inside emacs
tallys has joined #ruby
<sarna> lester29: everything's okay, but I'd advise to take one thing at a time
<sarna> or - you could try them together, and if you get too frustrated, drop emacs for something else for a while
gr33n7007h has quit [Ping timeout: 246 seconds]
<sarna> doom is a good framework for emacs btw - https://github.com/doomemacs/doomemacs
<sarna> I've never used vanilla emacs, it's too painful for me :)
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
<lester29> ok, i'll go with emacs and ruby
<lester29> i'll focus on these two things
<sarna> have fun!
<lester29> do you know how do I verify if user input is a number, and if not print error message and ask user gain? when I enter 'abcdef' at gets.chomp.to_i, input string is converted to 0
sphex has quit [Remote host closed the connection]
<sarna> `to_i` returns 0 in case of failure, so it's not the best option here. try `Integer(foo)` or `Float(foo)` depending on which you want
<lester29> ty
tallys has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
<ox1eef_> Integer(foo, exception: false).nil?
<ox1eef_> If nil is returned you know the input is not a valid number.
<lester29> or begin rescue
<ox1eef_> I would avoid it.
<leftylink> I hate it when that happens
<lester29> i started with simple programs in ruby to avoid too much burden myself
<lester29> such as calculator, various menu console apps
<lester29> i can't wait to learn the rails
<lester29> i see in my city there are well-paid jobs for ruby on rails developers
<lester29> btw i think whether i want or not, some things i'll have to learn simultaneously such as english language, subjects required by my school
<lester29> i'm computer science student
<lester29> so better question would be on how to organize time efficiently instead of "should i learn it together with it"
sagax has joined #ruby
roadie has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.92)]
Guest10 has joined #ruby
<Guest10> what is ruby
Guest10 has quit [Client Quit]
<lester29> what's better way to define enums? module Foo BAR = 1 or symbols?
<sarna> lester29: I like to put symbols in a module, example https://git.sr.ht/~sarna/rublox/tree/main/item/lib/token.rb#L6
<sarna> there's a trick at the end - `private_constant(*constants)` - it's so that when I `include` the module, the constants are not re-exported by the class I'm including it in
<lester29> what's the difference between putting symbols in a module instead of a class, for instance class XYZ CONSTANT_1 = :constant_1
<lester29> why do you put your constants in modules instead of classes?
<sarna> classes should have meaningful instances
<sarna> in my case, `TokenType` is just a group of constants, nothing more
Spengl has joined #ruby
markong has joined #ruby
Spengl has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
brokkoli_origin has quit [Quit: (Leaving)]
brokkoli_origin has joined #ruby
TomyLobo has joined #ruby
<lester29> how can I pass parameter values by keywords without putting in the declaration of the function :foo, like in python def f(x): pass; f(x=2)?
<leftylink> the only valid ways to call and declare functions are listed in https://docs.ruby-lang.org/en/3.0/syntax/calling_methods_rdoc.html#label-Arguments
<leftylink> oh I'm sorry, that's only the valid ways to call functions. defining functions and their parmeters is in https://docs.ruby-lang.org/en/3.0/syntax/methods_rdoc.html#label-Arguments
Fuente90 has joined #ruby
<leftylink> if I want to specify at the call site which argument is assigned to which parameter, I must use keyword arguments. I cannot use =, because = is an assignment to a local variable
Fuente90 has quit [Remote host closed the connection]
Fuente90 has joined #ruby
Fuente90 has quit [Remote host closed the connection]
Fuente90 has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Client Quit]
jess has quit [Quit: make good choices]
podge has quit [Ping timeout: 260 seconds]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Quit: Leaving...]
podge has joined #ruby
roadie has joined #ruby
gr33n7007h has quit [Ping timeout: 245 seconds]
gr33n7007h has joined #ruby
Fuente90 has quit [Remote host closed the connection]
gr33n7007h has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Quit: Leaving...]
buckwheatsuperpo has joined #ruby
CrazyEddy has quit [Ping timeout: 246 seconds]
podge has quit [Quit: Konversation terminated!]
sphex has joined #ruby
patrick has quit [Killed (NickServ (GHOST command used by podge!~patrick@fsf/member/patrick))]
patrick has joined #ruby
patrick has quit [Killed (platinum.libera.chat (Nickname regained by services))]
patrick_ has joined #ruby
patrick_ is now known as patrick
Saling89 has joined #ruby
Saling89 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
patrick has quit [Killed (NickServ (GHOST command used by podge!~patrick@fsf/member/patrick))]
patrick has joined #ruby
patrick is now known as Guest276
Guest276 has quit [Killed (erbium.libera.chat (Nickname regained by services))]
patrick_ has joined #ruby
patrick has joined #ruby
<lester29> do I apply the parentheses right way?
<lester29> should I apply parentheses only before ( in the compound expression or at your discretion?
<lester29> I mean let's suppose expressions like this Float gets.chomp vs Float(gets.chomp)
buckwheatsuperpo has quit [Quit: Leaving...]
<ox1eef_> Up to your preference. Functionally the same.
buckwheat has joined #ruby
buckwheat has quit [Client Quit]
buckwheat has joined #ruby
Domini has joined #ruby
buckwheat has quit [Quit: WeeChat 3.8]
buckwheat has joined #ruby
keypresser86 has joined #ruby
thelounge18 has joined #ruby
<KOTP> Float gets or Float(gets) is just style. No need to use chomp at all, since a number will not have a newline, so no reason to remove it with an additional method call.
buckwheat has quit [Quit: WeeChat 3.8]
buckwheat has joined #ruby
buckwheat has quit [Client Quit]
buckwheat has joined #ruby
buckwheat has quit [Client Quit]
buckwheat has joined #ruby
buckwheat has quit [Quit: WeeChat 3.8]
buckwheat has joined #ruby
Domini has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
buckwheat has left #ruby [WeeChat 3.8]
buckwheat has joined #ruby
buckwheat has quit [Quit: WeeChat 3.8]
buckwheat has joined #ruby
markong has quit [Ping timeout: 246 seconds]
Thanzex has quit [Quit: The Lounge - https://thelounge.chat]
Thanzex has joined #ruby
gr33n7007h has quit [Ping timeout: 264 seconds]
Thanzex has quit [Quit: The Lounge - https://thelounge.chat]
Thanzex has joined #ruby
_ht has quit [Quit: _ht]
sam113102 has joined #ruby
sam113101 has quit [Ping timeout: 260 seconds]
sam113102 is now known as sam113101
sam113102 has joined #ruby
sam113101 has quit [Ping timeout: 245 seconds]
sam113102 is now known as sam113101
hololeap is now known as wholesomeleap
wholesomeleap is now known as hololeap
roadie has quit [Ping timeout: 255 seconds]
<ox1eef_> KOTP: gets is always going to add a newline, whether it receives a pure number or whatever else.
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
desnudopenguino has quit [Remote host closed the connection]
tomtmym has quit [Quit: Gone.]
c10l has joined #ruby
<mooff> = '>> Object.new.tap { |o| def o.inspect() "= :lol" end }'
<ruby-eval> => ">> Object.new.tap { |o| def o.inspect() \"= :lol\" end }"
<mooff> dang it! lol
desnudopenguino has joined #ruby
desnudopenguino1 has joined #ruby
<mooff> = @n = 5; def lol() if n > 0; @n -= 1; puts ">> puts '= lol'" end end
<ruby-eval> => :lol
<mooff> = lol
<ruby-eval> ERROR: undefined local variable or method `n' for main:Object
<ruby-eval> (eval):1:in `lol'
<ruby-eval> Did you mean? @n
<mooff> = @n = 5; def lol() if @n > 0; @n -= 1; puts ">> puts '= lol'" end end; lol
<ruby-eval> >> puts '= lol'
<ruby-eval> => nil
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
<mooff> thwarted
roadie has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
kenichi has quit [Remote host closed the connection]
cnsvc has quit [Quit: %bye%]
kenichi has joined #ruby
cnsvc has joined #ruby
kenichi has quit [Changing host]
kenichi has joined #ruby
Linux_Kerio has quit [Ping timeout: 250 seconds]
markong has joined #ruby
surrog has joined #ruby
surrog has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
roadie has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
goldfish has joined #ruby
keypresser86 has quit []
roadie has joined #ruby
goldfish has quit [Remote host closed the connection]
goldfish has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
m_antis has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
m_antis has joined #ruby
Na_Klar has joined #ruby