favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
u0_a147 has quit [Client Quit]
u0_a147 has joined #ruby
u0_a147 has quit [Client Quit]
swaggboi has joined #ruby
gcd has quit [Ping timeout: 272 seconds]
gcd has joined #ruby
_ht has quit [Remote host closed the connection]
yossarian has quit [Ping timeout: 248 seconds]
yossarian has joined #ruby
yossarian has quit [Changing host]
yossarian has joined #ruby
favadi has joined #ruby
jpn has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
jpn has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
dionysus69 has joined #ruby
Vonter has quit [Quit: WeeChat 3.5]
<comet23>
why am i getting a name error? Traceback (most recent call last):
<comet23>
1: from main.rb:14:in `<main>'
<comet23>
main.rb:2:in `power_of_two?': undefined local variable or method `current_num' for main:Object (NameError) https://bpa.st/ZWSQ
unyu has quit [Quit: WeeChat 3.5]
mbarbar has quit [*.net *.split]
dionysus69 has quit [Ping timeout: 246 seconds]
whysthatso12507 has quit [Quit: Ping timeout (120 seconds)]
whysthatso12507 has joined #ruby
entropie has quit [Quit: ""]
aindilis_ has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
entropie has joined #ruby
___nick___ has joined #ruby
aindilis has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
jpn has joined #ruby
comet23 has quit [Quit: Client closed]
jpn has quit [Ping timeout: 246 seconds]
hololeap has quit [Ping timeout: 240 seconds]
hololeap has joined #ruby
dionysus69 has joined #ruby
Vonter has joined #ruby
factor8 has joined #ruby
jmcgnh has quit [Ping timeout: 272 seconds]
jmcgnh has joined #ruby
Roy_Mustang has joined #ruby
A_Dragon has quit [Killed (NickServ (GHOST command used by Roy_Mustang))]
Roy_Mustang is now known as A_Dragon
roadie has quit [Ping timeout: 248 seconds]
moo- has joined #ruby
factor has quit [Ping timeout: 256 seconds]
factor8 is now known as factor
moo has quit [Remote host closed the connection]
ur5us has joined #ruby
jpn has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
roadie has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
jpn has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
sylario has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
jpn has joined #ruby
favadi has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
o|||||o has joined #ruby
Rounin has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
favadi has joined #ruby
favadi has quit [Client Quit]
moldorcoder7 has quit [Ping timeout: 248 seconds]
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
TCZ has joined #ruby
markong has joined #ruby
favadi has joined #ruby
TCZ has quit [Quit: Tcl has many different data types, not just strings.]
Milos_ has quit [Ping timeout: 252 seconds]
Milos has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
<John_Ivan_>
what is the general approach to ruby's error checking?
<John_Ivan_>
exceptions with try/catch?
<John_Ivan_>
or is it a mixture alongside return values?
<John_Ivan_>
and if that's the case, is there any point in doing "if object == nil" ?
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
jpn has quit [Ping timeout: 240 seconds]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Remote host closed the connection]
Thanzex has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
<adam12>
John_Ivan_: I'd use exceptions for anything exceptional. Because you don't have to rely on the caller to check the return value.
<adam12>
There's nothing wrong with using the return value tho, but in that case it might not be an error but more so control flow.
<John_Ivan_>
adam12, that's satisfactory. also, would you use a try/catch for every single object method or would you wrap multiple calls from multiple objects under a single try-catch?
Sheilong has joined #ruby
<adam12>
John_Ivan_: Every situation would probably be different for me. I might rescue at the block level, or wrap a single method call in a begin/rescue.
<John_Ivan_>
adam12, fair enough :) - thank you.
<adam12>
Ideally, I want to limit the blast radius unless it's a specific exception. Because error handling for ArgumentError is going to be different than IOError.
Sheilong has quit [Quit: Connection closed for inactivity]
crankharder has quit [Ping timeout: 240 seconds]
crankharder has joined #ruby
Sheilong has joined #ruby
rawley has quit [Ping timeout: 246 seconds]
crankharder has quit [Ping timeout: 250 seconds]
orbyt has joined #ruby
crankharder has joined #ruby
ZorgonPeterson has joined #ruby
ZorgonPeterson has quit [Quit: WeeChat 3.5]
_ht has joined #ruby
rhe7 has joined #ruby
fowl6 has joined #ruby
jhawthorn_ has joined #ruby
Roy_Mustang has joined #ruby
A_Dragon has quit [Killed (sodium.libera.chat (Nickname regained by services))]
Roy_Mustang is now known as A_Dragon
ferr_ has joined #ruby
duds-_ has joined #ruby
KOTP has joined #ruby
axisys_ has joined #ruby
_ht_ has joined #ruby
jimeh_ has joined #ruby
Henry151_ has joined #ruby
<crankharder>
adam12: aha - nice find. seems to work for me. though, seems odd to pass a specific jemalloc dir to a seemingly generic option like that.
<adam12>
crankharder: Indeed, tho I think it's fine.
<adam12>
You can pass multiple, so it serves the correct purpose IMHO. Strange that there's no --with-jemalloc-dir or similar.
<adam12>
But I won't argue with the maintainer of the autoconf file. They have enough to deal with just dealing with autoconf :P
<adam12>
Just looking at configure.ac triggered me.
<crankharder>
the internet is chock full of references to --with-jemalloc-dir/include/lib/etc
<crankharder>
which is obviously truth
_ht has quit [*.net *.split]
orbyt has quit [*.net *.split]
gr33n7007h has quit [*.net *.split]
oxfuxxx has quit [*.net *.split]
Vonter has quit [*.net *.split]
axisys has quit [*.net *.split]
Henry151 has quit [*.net *.split]
jimeh has quit [*.net *.split]
kaivai has quit [*.net *.split]
sam113101 has quit [*.net *.split]
fercell has quit [*.net *.split]
duds- has quit [*.net *.split]
PedroG1 has quit [*.net *.split]
jhawthorn has quit [*.net *.split]
fowl has quit [*.net *.split]
jidar has quit [*.net *.split]
finsternis has quit [*.net *.split]
rhe has quit [*.net *.split]
IsoLinCHiP has quit [*.net *.split]
duds-_ is now known as duds-
rhe7 is now known as rhe
fowl6 is now known as fowl
jimeh_ is now known as jimeh
mbarbar has joined #ruby
<crankharder>
interesting. just tried on intel chip and that command does not work. ends up w/ the same error
Vonter has joined #ruby
oxfuxxx has joined #ruby
orbyt has joined #ruby
kaivai has joined #ruby
sam113101 has joined #ruby
gr33n7007h has joined #ruby
PedroG1 has joined #ruby
IsoLinCHiP has joined #ruby
finsternis has joined #ruby
jidar has joined #ruby
finsternis has quit [Max SendQ exceeded]
finsternis has joined #ruby
oxfuxxx has quit [Ping timeout: 246 seconds]
moldorcoder7 has joined #ruby
comet23 has joined #ruby
ule has quit [Ping timeout: 256 seconds]
<comet23>
how do i check if a particular substring is at the end?
<crankharder>
str[-(sub.length + 1) .. -1] == sub - or somethin like that might be simpler
orbyt has joined #ruby
<comet23>
but what if i have a vowel in the middle of the string and then it ends in that same vowel
<comet23>
like abracadabra
<crankharder>
the above doesn't care what's in the middle
impermanence has joined #ruby
oxfuxxx has joined #ruby
orbyt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
comet23: Are you trying to recreate something like end_with?
<adam12>
:: "foo".end_with?("o")
<adam12>
I'm not really following.
<adam12>
>> true
<comet23>
basically i'm trying to create something that slices from start to finish but not all strings are working
<adam12>
We need a better eval bot.
<adam12>
comet23: imho, require "minitest/autorun", then define a test class in that file with some asserts. It's easier to follow if you're sharing.
<comet23>
like jump => j ju jum jump u um ump m mp p
<adam12>
Oh I see. Some sort of permutation calculation.
<comet23>
yeah put that in an array i just want to know how i can tell i'm at the very last character
<comet23>
let's say abracadabra as a string input for example my code will slice it incorrectly
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
<comet23>
okay i figured it out i knew where the mistake was but i have no idea how my code works just something inside my brain told me to do it this way
sgt_chuckles has joined #ruby
sgt_chuckles has quit [Remote host closed the connection]
sgt_chuckles has joined #ruby
<sgt_chuckles>
im trying to write an rspec where code is duplicated in the `it` blocks. So I made the duplicate code into a function that takes a parameter, so the it blocks can call it. Im wondering if I can do this using `before` or `let`
<adam12>
sgt_chuckles: Maybe not if it accepts a parameter. But share code if you can and we can look.
<comet23>
i ended up doing this: while end_idx <= str.slice(curr_idx, end_idx).length
<comet23>
it would be nice if someone could explain how this works... i have no idea why but my intuition told me to do it this way and i tried it and it worked
<comet23>
i hate magic =(
<adam12>
comet23: Can I share my example?
<comet23>
sure
<adam12>
I don't have time to fiddle with it any more. But I don't want to ruin homework or anything.
<sgt_chuckles>
adam12: That's why I resorted to using a function for this, but im told it's not the best approach
<leah2>
that's not golf, that's fortran thinking :p
<comet23>
i missed his example because i was busy working on mine i'm scrolling up!
<leah2>
but it should work nicely with string sharing
<sgt_chuckles>
adam12: gee, thanks!
<adam12>
sgt_chuckles: For your example, I'm just saying to duplicate the method body in your tests. There's less indirection.
<adam12>
sgt_chuckles: Again, it doesn't answer your question, but rspec is notorious for indirection, which is horrible for tests.
<comet23>
what's indirection?
<sgt_chuckles>
yeah, im realizing how much i miss pytest :p
<adam12>
sgt_chuckles: Technically you could extract `active` to a let, then setup a `before` block, and then have a bunch of `describe` blocks that set `active`.
<comet23>
the course i'm taking now uses rspec exclusively
<adam12>
sgt_chuckles: The rspec book is good, if you're spending any time with it. It's from the author of RSpec.
<sgt_chuckles>
i'll check it out
<adam12>
I find rspec has a lot of nice stuff, but too much indirection when people write it. You can be 6 levels deep looking for a `let`.
emcb54 has joined #ruby
<leah2>
yeah
<leah2>
embrace simplicity, use bacon :p
<adam12>
I miss bacon
<adam12>
I only write minitest anymore.
<leah2>
it's close :p
<adam12>
but it's not perfect either.
<adam12>
bacon had a test runner I think? I do enjoy that from rspec.
<adam12>
I use minitest-sprint, but it's just another gem I need to have handy.
<leah2>
it just runs all tests always no?
<comet23>
why did it get abandoned?
<leah2>
it's not abandoned, it's finished :p
<adam12>
leah2: It has a good path matcher. so you could `minitest test -test/slow.rb` or something.
<comet23>
how is it finished? i thought nothing ever is finished
<adam12>
leah2: But by default, it runs all files in `test`.
<adam12>
or spec too, I think.
<adam12>
It also supports running tests by name, showing test failures and how to re-run them, and passing a seed nicely.
<leah2>
mhm
<adam12>
Ahh. bacon supports TAP
<leah2>
yes
<adam12>
There was a new test framework out just recently that tried separating tests from running tests.
<adam12>
I wonder if that has any merit.
<adam12>
I feel like TAP was in that direction.
<leah2>
i use tap for all my shell scripts testing C programs to
<adam12>
I haven't used tap in a million years.
roadie has joined #ruby
<adam12>
comet23: I annotated my gist with some comments. And removed the dup and slice! calls, since originally I wanted to slice! but I was actually re-assigning and not paying attention.
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest4 has quit [Client Quit]
roadie has joined #ruby
<havenwood>
sgt_chuckles: I don't think #hash_including compares keys the way you expect. Sec, lemme check the rspec mocks code.
crankharder has joined #ruby
<sgt_chuckles>
i want to verify the values in a fuzzy manner
<havenwood>
sgt_chuckles: Yeah, RSpec Mock specs don't show matching fuzzily, just exact matches, not ===.
dionysus69 has quit [Ping timeout: 260 seconds]
<havenwood>
sgt_chuckles: I follow your intention but think you'll have to iterate through to #match? if you want that behavior, since #hash_including doesn't seem to from waht I'm seeing.
some14u has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
<sgt_chuckles>
havenwood: can you cite an example, or docs for this?
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
ollysmith has joined #ruby
shokohsc has quit [Read error: Connection reset by peer]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadie has quit [Ping timeout: 248 seconds]
shokohsc has joined #ruby
sylario has quit [Quit: Connection closed for inactivity]
jpn has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
<havenwood>
sgt_chuckles: Actually, I take it back. I was looking at the wrong code in a multitasking fail.