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/
mexen has quit [Quit: Connection closed for inactivity]
cognemo has joined #ruby
roadie has joined #ruby
weaksauc_ has joined #ruby
cek has quit [Ping timeout: 240 seconds]
cek has joined #ruby
CrazyEddy has quit [Ping timeout: 240 seconds]
weaksauce has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 240 seconds]
moldorcoder7 has quit [Ping timeout: 255 seconds]
roadie has joined #ruby
markong has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
hays has joined #ruby
hexology has quit [Ping timeout: 255 seconds]
_whitelogger has quit [Ping timeout: 240 seconds]
heartburn has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ruby
egality_ has quit [Ping timeout: 240 seconds]
heartburn has joined #ruby
yosafbridge has joined #ruby
mahlon_ has joined #ruby
johnjaye has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
splud_ has quit [Quit: Leaving]
llua has joined #ruby
splud has joined #ruby
KOTP has joined #ruby
pjaspers has joined #ruby
caedmon has joined #ruby
egality has joined #ruby
matoro has joined #ruby
desnudopenguino has joined #ruby
tsujp has joined #ruby
summerisle has joined #ruby
rvalue has joined #ruby
alexisg has joined #ruby
dorian has joined #ruby
pounce has joined #ruby
hwrd has joined #ruby
peder has joined #ruby
duderonomy has joined #ruby
keypresser86 has joined #ruby
splud has joined #ruby
splud has quit [Changing host]
slondr has joined #ruby
kaivai has joined #ruby
g_sg has joined #ruby
weaksauce has joined #ruby
matta has joined #ruby
glider has joined #ruby
mags has joined #ruby
Liothen_ has joined #ruby
caleb has joined #ruby
Fusl_ has joined #ruby
sgtapple has joined #ruby
johnhamelink has joined #ruby
sphex has joined #ruby
ollysmith has quit [Ping timeout: 268 seconds]
ollysmith has joined #ruby
whereiseveryone has joined #ruby
splud is now known as splud_
splud_ is now known as splud
roadie has joined #ruby
Doc_IX has joined #ruby
dza has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
joast has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
ap4y has joined #ruby
roadie has joined #ruby
<johnjaye> why when I declare a class with a lower case letter ruby says it must be CONSTANT
<johnjaye> shouldn't it say, should be capital or camel case?
roadie has quit [Ping timeout: 240 seconds]
<weaksauce> johnjaye because the only thing that makes a constant a constant is the first letter being capitalized
<weaksauce> so it's more accurate
<weaksauce> FOO = 1 is a constant
<johnjaye> ok. normally i wouldn't refer to a class name as a constant.
<johnjaye> although in a way i suppose it is
<weaksauce> yeah they are constants
<weaksauce> there is only one
<johnjaye> there's a weird java pattern that reminds me of.
<weaksauce> you can reassign it but it's supposed to be singularly defined
<johnjaye> i think it's called the singleton class or singleton pattern or something
<weaksauce> yeah it's like that in a way but less so
<johnjaye> that's where you define a class and there's only one global instance of that class
<johnjaye> not sure if ruby has an equivalent
<weaksauce> you can create singletons in ruby yes
<johnjaye> it says here in java the technique is to hide the constructor
<johnjaye> and then put the object inside itself.
<johnjaye> o_0
kaivai has quit [Ping timeout: 255 seconds]
kaivai has joined #ruby
roadie has joined #ruby
Doc_IX has quit [Ping timeout: 255 seconds]
dorian has quit [Ping timeout: 255 seconds]
duderonomy has quit [Ping timeout: 255 seconds]
Fusl_ has quit [Ping timeout: 255 seconds]
Doc_IX has joined #ruby
dorian has joined #ruby
duderonomy has joined #ruby
Fusl_ has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
MalusVulgaris has joined #ruby
jhass has quit [Ping timeout: 240 seconds]
<johnjaye> weaksauce: this may sound obvious, but is interpolation inside a class valid just because of the @ character?
<johnjaye> i.e. puts "#{myvar}" vs puts "#@myvar" inside a method
jhass has joined #ruby
r3m has quit [Quit: WeeChat 4.0.0-rc1]
<weaksauce> i can't say i've used the latter johnjaye
<leftylink> pandabot: tell johnjaye ruby syntax
r3m has joined #ruby
<weaksauce> but i do recall some weird behavior regarding that
<ox1eef_> >> @x = 1; "#@x"!
<ox1eef_> >> @x = 1; "#@x"
roadie has joined #ruby
<johnjaye> wow. ruby has the same single quote double quote distinction as python.
<johnjaye> did both copy that from bash or where did that come from
<ox1eef_> If it worked, it would print 1. You can run code within a class body as well.
<ox1eef_> I would say Ruby is inspired by a bunch of languages. Sometimes you can see C, sometimes you can see Perl, sometimes you can see Lisp, ....
jhass has quit [Ping timeout: 255 seconds]
<ox1eef_> gnight
<johnjaye> i thought python was clever but then I realized it took a lot of its syntax like the : slicing from other languages
jhass has joined #ruby
<ox1eef_> Standing on the shoulders of giants. Always.
roadie has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
<sphex> johnjaye: perl had that. which probably took it from the bourne shell. not sure how Unix shells did it before that... and perl/ruby allow backslash escapes of the delimiter in single-quoted strings, while bourne shell does not.
roadie has quit [Ping timeout: 240 seconds]
jhass has quit [Ping timeout: 240 seconds]
jhass has joined #ruby
cek_ has quit [Quit: Connection closed for inactivity]
hays has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
John_Ivan has joined #ruby
neshpion has quit [Quit: neshpion]
Al2O3 has joined #ruby
yetoo has joined #ruby
dorian has quit [Ping timeout: 255 seconds]
Fusl_ has quit [Ping timeout: 255 seconds]
ap4y has quit [Remote host closed the connection]
dorian has joined #ruby
Fusl_ has joined #ruby
caedmon has joined #ruby
NightMonkey has quit [Server closed connection]
NightMonkey has joined #ruby
luca_rtc has quit [Remote host closed the connection]
_ht has joined #ruby
nickjj has quit [Read error: Connection reset by peer]
record64 has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
caedmon has joined #ruby
record64 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
caedmon has quit [Ping timeout: 240 seconds]
jhass has quit [Ping timeout: 240 seconds]
jhass has joined #ruby
roadie has joined #ruby
caedmon has joined #ruby
CrazyEddy has joined #ruby
caedmon has quit [Ping timeout: 255 seconds]
roadie has quit [Ping timeout: 240 seconds]
panella32 has joined #ruby
<panella32> Hi
<panella32> Is is possible to put erb output tag inside a string? like this: <%= image_tag "some/static/path/<%= movie.bg_path %>"
<panella32> If it's not, I think I have to use ruby's string interpolation, right? but is it safe?
<panella32> (Sorry if it's not clear enough. it's a nested erb tag but I forgot the closing tag)
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
roadie has joined #ruby
<sam113101> why would it be safe?
roadie has quit [Ping timeout: 240 seconds]
rvalue has quit [Ping timeout: 260 seconds]
panella32 has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
<sam113101> why would it *not* be safe?
otisolsen70 has joined #ruby
rvalue has joined #ruby
panella32 has joined #ruby
infinityfye has joined #ruby
roadie has joined #ruby
jprokop has joined #ruby
teclator has joined #ruby
MalusVulgaris has quit [Ping timeout: 240 seconds]
hightower2 has joined #ruby
mynameisdebian has quit [Remote host closed the connection]
mynameisdebian has joined #ruby
mynameisdebian has quit [Remote host closed the connection]
panella32 has quit [Ping timeout: 260 seconds]
Sankalp has quit [Ping timeout: 255 seconds]
Sankalp has joined #ruby
sts has quit [Server closed connection]
sts has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
kaivai has quit [Ping timeout: 255 seconds]
FabioPort has joined #ruby
gr33n7001 has quit [Changing host]
gr33n7001 has joined #ruby
gr33n7001 is now known as gr33n7007h
gr33n7007h has quit [Quit: WeeChat 3.8]
gr33n7007h has joined #ruby
kaivai has joined #ruby
teclator has quit [Ping timeout: 246 seconds]
teclator has joined #ruby
gr33n7007h has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
roshanavand_ has joined #ruby
lena64t2 has joined #ruby
lena64t1 has quit [Ping timeout: 240 seconds]
ox1eef_ has quit [Server closed connection]
roshanavand_ has quit [Ping timeout: 240 seconds]
desnudopenguino has quit [Quit: desnudopenguino]
infinity_fye has joined #ruby
infinityfye has quit [Ping timeout: 240 seconds]
infinity_fye has quit [Client Quit]
reset has joined #ruby
thecoolbrian has joined #ruby
roshanavand_ has joined #ruby
thecoolbrian has quit [Quit: Client closed]
moldorcoder7 has joined #ruby
Pixi has quit [Ping timeout: 240 seconds]
markong has joined #ruby
<Bish> my pry is not accepting utf8 content whats habbending
yassernasc has joined #ruby
FabioPort has quit [Quit: Client closed]
FabioPort has joined #ruby
kaivai has quit [Ping timeout: 255 seconds]
nona has quit [Server closed connection]
nona has joined #ruby
FabioPort has quit [Quit: FabioPort]
FabioPort has joined #ruby
FabioPort has left #ruby [#ruby]
jidar has quit [Quit: Remote host closed the connection]
BazzaBazaa has joined #ruby
kaivai has joined #ruby
dostoyevsky2 has quit [Server closed connection]
dostoyevsky2 has joined #ruby
juuh42dias has quit [Read error: Connection reset by peer]
jhass[m] has quit [Read error: Connection reset by peer]
hsiktas[m] has quit [Read error: Connection reset by peer]
Fernando-Basso has quit [Write error: Connection reset by peer]
hexology has joined #ruby
juuh42dias has joined #ruby
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
brokkoli_origin has quit [Ping timeout: 240 seconds]
brokkoli_origin has joined #ruby
Fernando-Basso has joined #ruby
jhass[m] has joined #ruby
hsiktas[m] has joined #ruby
Pixi has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
BazzaBazaa has joined #ruby
mekhami has joined #ruby
<mekhami> i'm getting a strange activerecord error that i don't know (I'm not a rubyist, so i don't have all the knowledge, but this one makes little sense besides)
<mekhami> the code is workign but i'm getting 50k of these errors in our error tracker every day
<mekhami> the code that ends up raising this is using `MyModel.find_or_create_by!`
BazzaBazaa has quit [Remote host closed the connection]
<havenwood> mekhami: The only thing that stands out to me on first glance is what looks to be a singular table name "user" instead of "users" in `"user"."access_token"`.
<havenwood> And the other `"user".` instances.
<havenwood> Someone hear might be able to spot the issue if you can share the model code.
eddof13 has joined #ruby
ox1eef_ has joined #ruby
teclator has quit [Ping timeout: 246 seconds]
nona has quit [Ping timeout: 268 seconds]
heinrich5991 has joined #ruby
hightower2 has quit [Ping timeout: 240 seconds]
<havenwood> *here
aesthetikx has quit [Server closed connection]
aesthetikx has joined #ruby
lena64t2 has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 240 seconds]
lena64t2 has joined #ruby
dviola has joined #ruby
hightower2 has joined #ruby
ryjo has joined #ruby
markong has quit [Ping timeout: 240 seconds]
_ht has joined #ruby
<heinrich5991> how do I implicitly convert a variable into a float?
<heinrich5991> https://idiosyncratic-ruby.com/54-try-converting.html says I can use `to_str` or `String.try_convert` for strings, and `to_int` for integers
dviola has quit [Ping timeout: 240 seconds]
friendlypunk has joined #ruby
rvalue has quit [Remote host closed the connection]
rvalue has joined #ruby
otisolsen70 has quit [Quit: Leaving]
dviola has joined #ruby
roshanavand_ has quit [Ping timeout: 240 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
c10l683 has joined #ruby
<weaksauce> heinrich5991 Float("somestring", exception: false)
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
kristianpaul has joined #ruby
kristianpaul has left #ruby [WeeChat 2.3]
eddof13 has joined #ruby
interl has joined #ruby
<leftylink> for an implicit conversion to make sense, there needs to be a situation where the language attempts to implicitly convert. I cannot think of a single situation where the language attempts to implicitly convert to a float
yassernasc has quit [Remote host closed the connection]
yassernasc has joined #ruby
<leftylink> the question "how do I implicitly convert" already isn't possible. you cannot implicitly convert. you can only put a variable in a situation where an implicit conversion would happen
c10l683 has quit [Quit: See ya! o/]
c10l683 has joined #ruby
interl has quit [Ping timeout: 265 seconds]
punche has joined #ruby
roshanavand_ has joined #ruby
bambanxx has quit [Quit: Textual IRC Client: www.textualapp.com]
_ht has quit [Quit: _ht]
punche has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
candlestick has joined #ruby
candlestick has left #ruby [#ruby]
henk has quit [Server closed connection]
henk has joined #ruby
<johnjaye> normally don't you implicitly convert to float if you divide an int by a float
<johnjaye> like 2 / 5.00000
ixti has joined #ruby
ryjo has quit [Quit: Client closed]
abade has joined #ruby
<abade> Olá! humanos \o/
ur5us has joined #ruby
ur5us has quit [Client Quit]
<heinrich5991> leftylink: Math.sin(0) seems to implicitly convert its argument from int to float
<heinrich5991> "how can I achieve the same thing as an implicit conversion to float?"
ixti has quit [Read error: Connection reset by peer]
ixti has joined #ruby
Thanzex3268 has quit [Ping timeout: 265 seconds]
<weaksauce> heinrich5991 val = val / 1.0
<weaksauce> or write the c code that math.sin is doing
<weaksauce> return DBL2NUM(sin(Get_Double(x)));
<johnjaye> weaksauce: i'd be afraid to write things like that in C. never know how the compiler will "optimize" your code away
<johnjaye> like herp derp a number divided by itself is 1, so i delete this lien
<weaksauce> johnjaye sure in c
<weaksauce> ruby it is a way to convert to float
<johnjaye> c also has really weird implicit conversion rules. the weirdest one is just a simple integer literal. it tries signed short, unsigned short, signed int, unsigned int etc until it finds a width that fits
<havenwood> johnjaye: I like to: 2.fdiv(5)
<johnjaye> i should use a stock catchphrase along with that. like, "This is what the C standard actually says".
<havenwood> I'd rather use #fdiv rather than #div or #/ with a Float on one side.
<havenwood> (Unless there's already a Float.)
Thanzex3268 has joined #ruby
<havenwood> Rational FTW? I don't actually have many terribly many opportunities to use Float.
<havenwood> >> 2/5r
<havenwood> #=> 2/5
ruby[bot] has joined #ruby
<johnjaye> what do the values of Encoding.aliases mean?
<johnjaye> like PCK=>Windows31J
<havenwood> (In that ^ case.)
<havenwood> "Solaris's SJIS variant."
<johnjaye> no i mean in context. why does it show something => something
<johnjaye> like BINARY=>ASCII-8BIT
<havenwood> johnjaye: Just means more than one way to reference it by name.
<havenwood> Some encodings are known by different names but are the same encoding.
<havenwood> Binary is shorthand for ASCII-8BIT.
<havenwood> And so on. They're just aliases since they're called different things in different OSes and by different programmer types.
<johnjaye> oh
<havenwood> Ruby tries to have more than one way to do it, so there's a natural option for you depending on where you're coming from.
<havenwood> Encoding::ASCII_8BIT == Encoding::BINARY #=> true
<havenwood> Even the same object_id, they're aliases.
abade is now known as Spock
Spock is now known as Guest8164
Guest8164 is now known as Spock
Spock is now known as Guest648
Guest648 has quit [Quit: leaving]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
markong has joined #ruby
tomtmym has quit [Quit: Gone.]
lena64t2 is now known as lena64t
roshanavand_ has quit [Ping timeout: 268 seconds]
desnudopenguino1 has joined #ruby
LispTyro_ has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
yassernasc has quit [Remote host closed the connection]
dviola has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
jprokop has quit [Quit: Leaving.]
moldorcoder7 has quit [Ping timeout: 260 seconds]
<leftylink> looks like I was wrong. I yield.
<leftylink> not `yield` the ruby keyword, but you know, the normal meaning of the word "yield"
<leftylink> as someone like me, a normal human being, would normally use it
ap4y has joined #ruby
factor has quit [Server closed connection]
factor has joined #ruby
mekhami has quit [Quit: WeeChat 2.8]
LispTyro_ has left #ruby [#ruby]
<ox1eef_> Ruby had more than way to do it before Rubocop arrived. Now parts of the language are essentially being erased. There's one way, the rubocop way.
moldorcoder7 has joined #ruby