Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
s3nd1v0g1us has joined #ruby
drincruz_ has quit [Ping timeout: 265 seconds]
sauvin has quit [Quit: Leaving]
sauvin has joined #ruby
NODE has quit [Remote host closed the connection]
NODE has joined #ruby
mossplix has joined #ruby
gix has quit [Ping timeout: 268 seconds]
skx86 has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
akemhp_ has quit [Ping timeout: 268 seconds]
cthulchu has quit [Ping timeout: 260 seconds]
reyfi9e has quit [Ping timeout: 240 seconds]
s3nd1v0g1us has quit [Quit: WeeChat 2.6]
im0nde has quit [Ping timeout: 248 seconds]
im0nde_ has joined #ruby
teclator has quit [Ping timeout: 260 seconds]
teclator has joined #ruby
wildtrees has quit [Quit: Leaving]
turbo_choo has joined #ruby
bvdw3 has joined #ruby
bvdw has quit [Ping timeout: 240 seconds]
bvdw3 is now known as bvdw
duderonomy has joined #ruby
rainer_tm has quit [Ping timeout: 240 seconds]
rainer_tm has joined #ruby
yokel has quit [Ping timeout: 268 seconds]
yokel has joined #ruby
phenom_ has joined #ruby
drincruz_ has joined #ruby
phenom has quit [Ping timeout: 260 seconds]
mossplix has quit [Remote host closed the connection]
jaequery has quit [Remote host closed the connection]
drincruz_ has quit [Ping timeout: 260 seconds]
subfj_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BTRE has quit [Quit: Leaving]
orbyt_ has joined #ruby
BTRE has joined #ruby
mossplix has joined #ruby
alex`` has quit [Ping timeout: 268 seconds]
mossplix has quit [Ping timeout: 260 seconds]
unreal has quit [Ping timeout: 258 seconds]
bvdw has quit [Ping timeout: 268 seconds]
bvdw has joined #ruby
emptyflask has joined #ruby
subfj has joined #ruby
ltd has quit [Ping timeout: 268 seconds]
pwnd_nsfw` has quit [Read error: Connection reset by peer]
pwnd_nsfw has joined #ruby
jaequery has joined #ruby
jaequery has quit [Ping timeout: 265 seconds]
hays has joined #ruby
hays has quit [Changing host]
hays has joined #ruby
subfj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ule>
Hey folks, do you know how to create a method that gets called at the end of a string? Lets say for example "foo".my_custom_method
<ule>
I have a feeling that If I "monkey patch" class String it could work
<AndroidKitKat>
that should work i believe
<ule>
Let me try here
<AndroidKitKat>
should be as simple as doing what i did at the top of this program (excuse how poorly the code is, this is one of the first ruby programs I work): https://waifupaste.moe/raw/asz.txt
kapil_ has quit [Quit: Connection closed for inactivity]
hays has quit [Ping timeout: 240 seconds]
<ule>
It worked!
<ule>
Thank you very much guys!
<havenwood>
ule: That's called "monkey patching." It'll change things globally, which you can only do so much before things go wrong. To keep the change nicely scoped to just where you need it, you can use a "refinement" instead.
<havenwood>
ule: If you've written all the code, monkey patching tends to work fine. If everyone monkey patches, they conflict globally.
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
ropeney has joined #ruby
turbo_choo has quit [Ping timeout: 258 seconds]
turbo_choo has joined #ruby
ur5us has joined #ruby
skx86 has quit [Quit: Connection closed for inactivity]
andikr has joined #ruby
lineus has quit [Remote host closed the connection]
lineus has joined #ruby
greenhat has joined #ruby
greenhat has quit [Ping timeout: 265 seconds]
DaRock has quit [Ping timeout: 265 seconds]
moonshine_ has joined #ruby
greenhat has joined #ruby
greenhat has quit [Ping timeout: 260 seconds]
moonshine_ has quit [Quit: leaving]
NL3limin4t0r_afk has quit [Quit: WeeChat 1.9.1]
pwnd_nsfw` has joined #ruby
pwnd_nsfw has quit [Ping timeout: 268 seconds]
dionysus69 has joined #ruby
BH23 has joined #ruby
cadeskywalker has quit [Ping timeout: 258 seconds]
NL3limin4t0r has joined #ruby
BH23 has quit [Ping timeout: 265 seconds]
ur5us has quit [Ping timeout: 260 seconds]
cadeskywalker has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NL3limin4t0r has quit [Ping timeout: 240 seconds]
NL3limin4t0r has joined #ruby
phaul has joined #ruby
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
conta has joined #ruby
mossplix has joined #ruby
chalkmonster has joined #ruby
BH23 has joined #ruby
conta has quit [Quit: conta]
chalkmon1 has joined #ruby
chalkmonster has quit [Ping timeout: 240 seconds]
mn3m has joined #ruby
greenhat has joined #ruby
greenhat has quit [Ping timeout: 260 seconds]
mossplix has quit [Remote host closed the connection]
turbo_choo has quit [Ping timeout: 265 seconds]
chalkmonster has joined #ruby
chalkmon1 has quit [Ping timeout: 265 seconds]
BH23 has quit [Ping timeout: 240 seconds]
turbo_choo has joined #ruby
william1_ has joined #ruby
rapha has joined #ruby
<rapha>
hi
howdoi has quit [Quit: Connection closed for inactivity]
<rapha>
is there a way to print or puts the equivalent of Ctrl+U (clear until beginning of line)?
andikr has quit [Ping timeout: 260 seconds]
<rapha>
(the only thing i know that works is `300.times {print "\b"}`, which is a little stupid…)
andikr has joined #ruby
mossplix has joined #ruby
pwnd_nsfw has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 265 seconds]
akemhp has joined #ruby
ellcs has joined #ruby
MrCrackPot has quit [Ping timeout: 265 seconds]
PaulePanter has quit [Remote host closed the connection]
<depesz>
rapha: what kind of terminal you're using?
<depesz>
something unix-ish?
<rapha>
depesz: yes, gnome-terminal in my case. Doesn't have to be portable.
<depesz>
rapha: ruby -e 'puts "abc\x1b[1K\rbbb"'
<rapha>
Wow, okay! How did you know about x1b and 1K?
<depesz>
rapha: man console_codes
chalkmon1 has joined #ruby
<depesz>
ECMA-48 CSI sequences => and then "K EL Erase line; ESC [ 1 K: erase from start of line to cursor."
<rapha>
Cool, thank you! :-D
<depesz>
ESC is \x1b.
PaulePanter has joined #ruby
<depesz>
there is quite a lot of interesting things in there
* rapha
reads
chalkmonster has quit [Ping timeout: 268 seconds]
<depesz>
all these things work by simply outputting them to terminal (that supports it, luckily most (if not all) unix-ish terminal programs i've seen support these)
<rapha>
that's exactly what i want. it's only a script for myself, not even going up on github or anything.
<depesz>
i use these things for virtually anything. easy progress information. colors. putting things in specific places on screen.
andikr has quit [Ping timeout: 240 seconds]
phaul has quit [Ping timeout: 265 seconds]
mossplix has quit [Ping timeout: 265 seconds]
phaul has joined #ruby
<rapha>
"easy progress information". you caught me.
clemens3 has joined #ruby
<depesz>
so you might know you can: ruby -e '0.upto(100) { |i| print "\rProgress: #{i}%"; sleep 0.05 }'
bruce_lee has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
<depesz>
but it's less obvious if the progres information can get shorter, for example: by writing description which step we're on. If I'd write: "Progress: initialization" and then "\rProgress: fetching", then on screen I would get: "Progress: fetchingzation"
<depesz>
but you can add \x1b[K at the end of progres info to clear the rest of line.
chalkmon1 has quit [Ping timeout: 268 seconds]
<rapha>
Yes, that was the problem I had: my info kept getting longer and shorter. Hence the original question! It's working perfectly now with the \x1b[K method.
turbo_choo has quit [Ping timeout: 265 seconds]
mossplix has joined #ruby
mossplix has quit [Ping timeout: 258 seconds]
akemhp has quit [Ping timeout: 240 seconds]
turbo_choo has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
chalkmonster has joined #ruby
impermanence has quit [Remote host closed the connection]
andikr has joined #ruby
cd has quit [Quit: cd]
mwlang has joined #ruby
<mwlang>
@havenwood, thanks for that gist yesterday with hooking TracePoint into the :call method. I was able to use it to log the differences between isolated test and full suite test and find where paths were differing. Really made my day to be able to do that!
<catphish>
alas, it seems that "bundle config build" does not work globally :(
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
alex`` has joined #ruby
akemhp has joined #ruby
chalkmonster has joined #ruby
bruce_lee has quit [Ping timeout: 268 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
bruce_lee has quit [Ping timeout: 258 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
MrCrackPot has joined #ruby
AJA4350 has joined #ruby
bsdbandit-01 has joined #ruby
davor has quit [Ping timeout: 260 seconds]
davor has joined #ruby
drincruz_ has joined #ruby
mossplix has quit [Remote host closed the connection]
ams__ has joined #ruby
mossplix has joined #ruby
william1_ has quit [Ping timeout: 268 seconds]
bruce_lee has quit [Ping timeout: 258 seconds]
drincruz_ has quit [Ping timeout: 260 seconds]
bruce_lee has joined #ruby
bsdbandit-01 has quit [Remote host closed the connection]
mwlang has quit [Quit: mwlang]
lucasb has joined #ruby
bsdbandit-01 has joined #ruby
cow[moo] has joined #ruby
mwlang has joined #ruby
bruce_lee has quit [Ping timeout: 268 seconds]
bruce_lee has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
cow[moo] has quit [Client Quit]
william1_ has joined #ruby
andikr has quit [Remote host closed the connection]
Jonopoly has joined #ruby
vondruch_ has joined #ruby
cow[moo] has joined #ruby
william1_ has quit [Ping timeout: 260 seconds]
vondruch has quit [Ping timeout: 268 seconds]
vondruch_ is now known as vondruch
bmurt has joined #ruby
bruce_lee has quit [Ping timeout: 260 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
troulouliou_div2 has joined #ruby
tk95 has joined #ruby
greenhat has joined #ruby
pwnd_nsfw has quit [Ping timeout: 268 seconds]
pwnd_nsfw has joined #ruby
greenhat has quit [Ping timeout: 260 seconds]
<mwlang>
Is there a difference between FOO = [“a”.freeze, “b”.freeze, “c”.freeze] vs FOO = [“a”, “b”, “c”].freeze. ? I am thinking of changing to the latter for readability, but not sure if that’s just freezing the Array itself or if it’ll freeze the strings inside the array as well.
mossplix has quit [Remote host closed the connection]
pwnd_nsfw` has joined #ruby
mossplix has joined #ruby
william1_ has joined #ruby
<leftylink>
former only freezes the strings and not the array. latter only freezes the array and not the strings
tk95 has quit [Remote host closed the connection]
troulouliou_div2 has quit [Quit: Leaving]
pwnd_nsfw has quit [Ping timeout: 260 seconds]
troulouliou_div2 has joined #ruby
william1_ has quit [Ping timeout: 260 seconds]
sagax has quit [Ping timeout: 268 seconds]
sagax has joined #ruby
Cope has joined #ruby
TomyWork has joined #ruby
turbo_choo has quit [Ping timeout: 268 seconds]
strangertims has joined #ruby
drincruz_ has joined #ruby
BTRE has quit [Quit: Leaving]
<mwlang>
thanks, @leftylink — So I should use former and also append freeze for completeness sake? i.e. FOO = [“a”.freeze, “b”.freeze, “c”.freeze].freeze — or is this overkill? This is probably a subjective question more than anything and I’m guessing falls into one of those best practices or ruby idioms category.
<catphish>
if you want everything frozen, that would be the full solution, yes
<catphish>
on the other hand, we have a policy of using "# frozen_string_literal: true" here, if you put that as the first line in your source files, all hardcoded strings will be frozen by default
strangertims has quit [Remote host closed the connection]
Emmanuel_Chanel has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<mwlang>
That seems like the more pragmatic solution.
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
davor_ has joined #ruby
davor has quit [Ping timeout: 240 seconds]
davor_ is now known as davor
BTRE has joined #ruby
Swyper has quit [Remote host closed the connection]
NODE has quit [Remote host closed the connection]
NODE has joined #ruby
NODE has quit [Remote host closed the connection]
NODE has joined #ruby
greenhat has joined #ruby
mwlang has quit [Quit: mwlang]
greenhat has quit [Ping timeout: 260 seconds]
Rob__ has joined #ruby
Swyper has joined #ruby
MrCrackPot has quit [Quit: Leaving]
pwnd_nsfw` has quit [Ping timeout: 265 seconds]
mossplix has quit [Remote host closed the connection]
NODE has quit [Remote host closed the connection]
CrazyEddy has quit [Remote host closed the connection]
NODE has joined #ruby
fphilipe has joined #ruby
fphilipe1 has quit [Ping timeout: 268 seconds]
sergioro has joined #ruby
Rudd0^^ has quit [Remote host closed the connection]
Rudd0^ has quit [Remote host closed the connection]
Rudd0 has quit [Remote host closed the connection]
sphex has quit [Ping timeout: 260 seconds]
Rudd0 has joined #ruby
CrazyEddy has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
mossplix has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.5]
mossplix has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
drincruz has joined #ruby
subfj has joined #ruby
drincruz_ has quit [Ping timeout: 260 seconds]
phaul has quit [Ping timeout: 260 seconds]
phaul has joined #ruby
TomyWork has quit [Ping timeout: 256 seconds]
Swyper has quit [Remote host closed the connection]
cthulchu_ has joined #ruby
impermanence has joined #ruby
fphilipe has quit [Read error: Connection reset by peer]
drincruz has quit [Ping timeout: 265 seconds]
sphex has joined #ruby
impermanence has quit [Remote host closed the connection]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
bsdbandit-01 has quit [Remote host closed the connection]
fphilipe has joined #ruby
mossplix has quit [Ping timeout: 265 seconds]
CrazyEddy has quit [Remote host closed the connection]
mossplix has joined #ruby
clemens3 has quit [Quit: WeeChat 2.1]
greenhat has joined #ruby
skx86 has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
sergioro has quit [Quit: leaving]
mossplix has quit [Ping timeout: 265 seconds]
kristian_on_linu has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
renich has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4350 has joined #ruby
fphilipe has quit [Ping timeout: 268 seconds]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
catphish has quit [Quit: Leaving]
mn3m has quit [Ping timeout: 268 seconds]
william1_ has joined #ruby
william1_ has quit [Ping timeout: 268 seconds]
phaul has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
wildtrees has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
NL3limin4t0r is now known as NL3limin4t0r_afk
TCZ has joined #ruby
jaequery has joined #ruby
suukim has quit [Quit: Konversation terminated!]
drincruz has joined #ruby
fphilipe has joined #ruby
NODE has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 240 seconds]
NODE has joined #ruby
nowhere_man has joined #ruby
snickers has joined #ruby
Exuma has joined #ruby
hiroaki has joined #ruby
davispuh has joined #ruby
Swyper has joined #ruby
mossplix has quit [Remote host closed the connection]