havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 2.7.2, 2.6.6, 3.0.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first! | BLM <3
Tempesta has joined #ruby
kindwindfall has joined #ruby
Technodrome has joined #ruby
Emmanuel_Chanel has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
TCZ has quit [Quit: Leaving]
howdoi has joined #ruby
bkuhlmann has joined #ruby
Rudd0 has quit [Ping timeout: 240 seconds]
gray-_-wolf has quit [Quit: WeeChat 2.9]
mikecmpbll has quit [Quit: inabit. zz.]
kindwindfall has quit [Quit: Leaving]
CrazyEddy has quit [Remote host closed the connection]
_whitelogger has joined #ruby
dasher00 has quit [Remote host closed the connection]
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 272 seconds]
roshanavand_ is now known as roshanavand
dionysus70 has quit [Quit: dionysus70]
dionysus69 has quit [Ping timeout: 240 seconds]
imode has joined #ruby
fredolinhares has joined #ruby
ChmEarl has quit [Quit: Leaving]
queip has joined #ruby
bkuhlman_ has joined #ruby
bkuhlmann has quit [Ping timeout: 240 seconds]
bkuhlman_ has quit []
fredolinhares has quit [Quit: WeeChat 2.8]
cthulchu_ has quit [Ping timeout: 272 seconds]
Rudd0 has joined #ruby
CrazyEddy has joined #ruby
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has quit [Ping timeout: 258 seconds]
rubydoc has quit [Ping timeout: 240 seconds]
Liothen has quit [Ping timeout: 244 seconds]
Liothen has joined #ruby
rubydoc has joined #ruby
rubydoc has quit [Ping timeout: 256 seconds]
rubydoc has joined #ruby
rubydoc has quit [Ping timeout: 265 seconds]
TheCoolBrian has joined #ruby
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
phaul has joined #ruby
rubydoc has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
vondruch has joined #ruby
cd has quit [Quit: cd]
cnsvc has quit [Ping timeout: 240 seconds]
burgestrand has joined #ruby
imode has quit [Ping timeout: 260 seconds]
SanguineAnomaly has joined #ruby
Jonopoly has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 240 seconds]
weaksauce has quit [Ping timeout: 256 seconds]
ap4y has quit [Ping timeout: 272 seconds]
wallace_mu has joined #ruby
mtsd has joined #ruby
wallace_mu has quit [Ping timeout: 246 seconds]
Mikaela has quit [Quit: Mikaela]
Mikaela has joined #ruby
banisterfiend has joined #ruby
banisterfiend has quit [Ping timeout: 256 seconds]
braincrash has joined #ruby
siaw23 has joined #ruby
TomyWork has joined #ruby
TheCoolBrian has quit [Read error: Connection reset by peer]
siaw23 has quit [Quit: Textual IRC Client: www.textualapp.com]
Takumo has quit [K-Lined]
ljarvis has quit [K-Lined]
EvilJStoker has quit [K-Lined]
EvilJStoker has joined #ruby
Takumo has joined #ruby
braincrash has quit [Ping timeout: 256 seconds]
blender has joined #ruby
blender_ has quit [Ping timeout: 272 seconds]
dionysus69 has joined #ruby
siaw23 has joined #ruby
mikecmpbll has joined #ruby
Sanderd17 has joined #ruby
akem_ is now known as akem
burgestrand has quit [Quit: burgestrand]
mtsd has quit [Quit: Leaving]
braincrash has joined #ruby
canton7 has quit [Quit: ZNC - http://znc.in]
edwardly has quit [Quit: ??????????]
canton7 has joined #ruby
deimos_ has quit [Ping timeout: 246 seconds]
edwardly has joined #ruby
maths22_ has quit [Ping timeout: 264 seconds]
nofxx_ has joined #ruby
nofxx has quit [Ping timeout: 264 seconds]
<Sanderd17> Hello, I'm new to Ruby (coming from other scripting languages like JS and Python)
<jhass> hey, welcome :)
<Sanderd17> I was reading about how "require" works in ruby, and it seems to polute the global namespace to me
nofxx has joined #ruby
vondruch has quit [Ping timeout: 258 seconds]
<Sanderd17> Python always had a way to import stuff that doesn't pollute the global namespace, and JS recently added ES modules, but had other module systems before
<jhass> it's file based, similar to how C or PHP does it for example, so yes there's no file based namespaces
<Sanderd17> My question is, do you ever get in trouble with that namespace pollution in practice? And are there plans to add a non-polluting require alternative?
<jhass> local variables are file local, but constants and of course globals are not
nofxx_ has quit [Ping timeout: 246 seconds]
<jhass> If you practice proper namespacing and naming convention it has never been any issue for me
<Sanderd17> Ok, good to hear
<jhass> in fact I had to fight with file based namespacing more, where things are not found or two files define the same function because, heh, we're namespaced so it's fine to do that at the toplevel!
<jhass> where as in Ruby people are more disciplined about that because there's no such concept
<Sanderd17> I also had to fight with file namespaces before (lately even an odd one, where I checked out a different branch, but as the -.pyc files aren't synchronised, python decided to use that instead of the py file I expected)
<Sanderd17> But as a newbie, it seems a bit difficult to deduce where a function is coming from (is it built in, or from something that's being required). How do you handle that?
<Sanderd17> Or do you need help from the IDE to handle that?
<jhass> if it's a call on an object or module it's pretty obvious I think
<jhass> for bare calls, often you can already tell from its name or context where it might come from
<jhass> worst case just look it up in ruby core docs and if you're in a Rails context those docs
<jhass> that should cover > 90% of the cases
<jhass> then I have two strategies: For bigger projects I always install dependencies using bundler to a site local folder, so I can just grep through that
<jhass> worst case I put a debugger and use introspection: method(:foo).source_location
<jhass> ?pry
<ruby[bot]> Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<jhass> ^ in general a great tool for exploring
Jonopoly has quit [Quit: WeeChat 2.9]
<Sanderd17> Ok, so for everyday usage, it boils down to choosing good names. Thanks for the link to the tool (apparently I get a 404, but I can find that tool on github)
<jhass> huh, did they change it
<jhass> !fact edit pry Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (http://pry.github.io/): gem install pry pry-doc
<ruby[bot]> jhass: I stand corrected that pry is Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (http://pry.github.io/)
<ruby[bot]> : gem install pry pry-doc
<Sanderd17> Thanks
ruurd has quit [Quit: bye folks]
dasher00 has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
dasher00 has quit [Ping timeout: 265 seconds]
Arkantos has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
siaw23 has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
Rudd0 has quit [Ping timeout: 265 seconds]
impermanence has joined #ruby
burgestrand has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 256 seconds]
ruurd has joined #ruby
akem has quit [Ping timeout: 264 seconds]
TCZ has joined #ruby
kaivai has quit [Ping timeout: 260 seconds]
vondruch has joined #ruby
akem has joined #ruby
Jonopoly has joined #ruby
Jonopoly has quit [Client Quit]
Jonopoly has joined #ruby
akem has quit [Quit: Leaving]
impermanence90 has joined #ruby
impermanence90 has quit [Client Quit]
impermanence41 has joined #ruby
impermanence has quit [Ping timeout: 260 seconds]
impermanence41 has quit [Client Quit]
ChmEarl has joined #ruby
akem has joined #ruby
crankharder has joined #ruby
Technodrome has joined #ruby
bmurt has joined #ruby
TCZ has quit [Quit: Leaving]
TCZ has joined #ruby
vondruch has quit [Ping timeout: 260 seconds]
impermanence has joined #ruby
deadk has quit [Quit: edk]
vondruch has joined #ruby
deadk has joined #ruby
TCZ has quit [Quit: Leaving]
yxhuvud has quit [Ping timeout: 260 seconds]
Sanderd17 has quit [Ping timeout: 245 seconds]
dionysus69 has quit [Ping timeout: 264 seconds]
mikecmpbll has joined #ruby
cthulchu_ has joined #ruby
chouhoulis has joined #ruby
BH23 has quit [Read error: Connection reset by peer]
chouhoulis has quit [Ping timeout: 265 seconds]
cd has joined #ruby
burgestrand has quit [Quit: burgestrand]
BSaboia has joined #ruby
akem has quit [Ping timeout: 264 seconds]
Rudd0 has joined #ruby
Technodrome has quit [Ping timeout: 265 seconds]
yxhuvud has joined #ruby
braincrash has quit [Ping timeout: 256 seconds]
mikecmpbll has quit [Ping timeout: 258 seconds]
mikecmpbll has joined #ruby
buckworst has joined #ruby
emdev has joined #ruby
emdev has quit [Max SendQ exceeded]
CactusJuan has joined #ruby
<CactusJuan> hello! have a question about adding elements to an array. so i have a super basic script that reads from a txt file and adds each line to my array. when i puts my array out, each element has \n appended to it. how do i get rid of the \n?
<CactusJuan> on 2.7.2 as well if that helps
orbyt_ has joined #ruby
<adam12> CactusJuan: How are you loading the lines from the txt file?
<CactusJuan> i am using File.readlines(file).each do .....
<adam12> CactusJuan: Try File.readlines(file, chomp: true)
<CactusJuan> @adam12 thank you! so simple
<adam12> CactusJuan: yw!
akem has joined #ruby
r29v has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dasher00 has joined #ruby
CactusJuan has quit [Ping timeout: 265 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
mikecmpbll has joined #ruby
cnsvc has joined #ruby
<isene> Is there any way to pass a string with ansi color codes directly into a curses window and let the terminal color the string rather than having to go via the curses color functions?
<akem> Did you try to use escape codes with puts?
<akem> It should works afaik.
<akem> Just tested it, it works fine.
<akem> ruby -e 'puts "\033[32mGreen"'
bmurt has joined #ruby
<havenwood> &>> puts "\033[38;5;42mWow, 257 colors (color 42 here)"
<rubydoc> # => [38;5;42mWow, 257 colors (color 42 here)... check link for more (https://carc.in/#/r/9v0j)
<havenwood> 0-256 is a funny scale
bmurt has quit [Ping timeout: 256 seconds]
<havenwood> puts 257.times.reduce('') { "#{_1}\033[38;5;#{_2}m." }
TCZ has joined #ruby
bmurt has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<isene> Of course I can output the ansi color codes to the terminal directly - but, my File manager (RTFM) needs to output the syntax highlighted files (via `bat`) to a curses window... and that's where it stops for me - since curses does its own color handling and converts the colors to ansi codes and only THEN outputs it to a terminal. So - what I am looking for is to circumvent the curses color handling
TCZ has quit [Quit: Leaving]
<isene> and output what comes from `bat` in raw form through the curses window... is there a way?
howdoi has joined #ruby
hiroaki has joined #ruby
ellcs has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> I guess you need whatever `bat` is using, not a subset.
TomyWork has quit [Quit: Leaving]
orbyt_ has joined #ruby
<isene> Seems like whatever I output to a curses window is interpreted as characters to print, and not as escape codes. So, all the escape codes get printed into the window. Of course I can do all kinds of regex gymnastics and convert the codes to what curses parses (back into ANSI codes again) - but I was hoping to avoid that roundabout way
bocaneri has quit [Remote host closed the connection]
vondruch has quit [Ping timeout: 260 seconds]
chouhoulis has joined #ruby
braincrash has joined #ruby
TCZ has joined #ruby
rippa has joined #ruby
weaksauce has joined #ruby
braincrash has quit [Ping timeout: 260 seconds]
r29v has quit [Quit: r29v]
dionysus69 has joined #ruby
notnatebtw has joined #ruby
notnatebtw has left #ruby ["WeeChat 2.9"]
impermanence has quit [Ping timeout: 256 seconds]
imode has joined #ruby
davispuh has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
crankharder has quit [Ping timeout: 265 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
braincrash has joined #ruby
duderonomy has quit [Client Quit]
duderonomy has joined #ruby
ap4y has joined #ruby
duderonomy has quit [Client Quit]
crankharder has joined #ruby
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
duderonomy has joined #ruby
ur5us has joined #ruby
riceandbeans has joined #ruby
<riceandbeans> How old of a Ruby can you install with rbenv?
<riceandbeans> I need to test something on 1.8.5, not excited about it, but not sure how else to get a Ruby 1.8.5
<jhass> Hum, I would imagine it depends on your OS to a good deal
<riceandbeans> Will it work to just rbenv install 1.8.5, gem install 'foo', irb, require 'foo' ?
<jhass> maybe install like CentOS 4 or 5 in a VM first?
<riceandbeans> Good idea, I'm going to vagrant this crap lol
CactusJuan has joined #ruby
gambl0re has joined #ruby
buckworst has quit [Quit: WeeChat 2.9]
gambl0re has left #ruby ["WeeChat 2.8"]
cliluw has joined #ruby
CactusJuan has left #ruby [#ruby]
BTRE has quit [Remote host closed the connection]
BTRE has joined #ruby
BTRE has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
BTRE has joined #ruby
nofxx_ has joined #ruby
nofxx has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
nofxx_ has quit [Ping timeout: 260 seconds]
<dionysus69> what on earth is using 1.8.5 hmm
<jhass> I don't know but I think it's a safe bet it's interfacing with cobol :D
crankharder has quit [Ping timeout: 258 seconds]
mikecmpbll has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
ellcs has joined #ruby
<riceandbeans> Ugh, I got a CentOS vm up in Vagrant but to get rubygems on it I had to fetch it and build it, and then I had to disable SSL to get it to work right, and then I had to install other crap
<riceandbeans> And yet, still I can't get it to install this one gem.
TCZ has joined #ruby
<riceandbeans> I think the gcc is too old on CentOS5
TCZ has quit [Remote host closed the connection]
<riceandbeans> If you want to have something use did_you_mean with a Ruby earlier than 2.3, is it sufficient to just have the gem install and require it?
Jonopoly has quit [Ping timeout: 246 seconds]
orbyt_ has joined #ruby
crankharder has joined #ruby
TCZ has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
dasher00 has quit [Ping timeout: 260 seconds]
regedit has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
nofxx has joined #ruby
nofxx has quit [Remote host closed the connection]
bmurt has joined #ruby
crankharder has joined #ruby
<havenwood> riceandbeans: You can use the gem for Ruby 2.1+.
<havenwood> riceandbeans: Don't use Ruby that old. :P
crankharder has quit [Ping timeout: 260 seconds]
crankharder has joined #ruby
banisterfiend has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
gray_-_wolf has quit [Quit: ZNC 1.7.1 - https://znc.in]
<riceandbeans> havenwood: I know, I know, but in the absence of that option, does it suffice to simply require the gem?
<riceandbeans> I've never actually used it before
<havenwood> riceandbeans: Yes, for Ruby 2.1 & 2.2 only and you might need to include a specific version so it doesn't refuse since your Ruby is too old.
<riceandbeans> god I just can't win
<riceandbeans> /tmp/ruby-build.20201021232238.4235.kB1llq/rubygems-1.3.7 /tmp/ruby-build.20201021232238.4235.kB1llq ~
<riceandbeans> ERROR: Expected Ruby version >= 1.8.6, is 1.8.5.231
<riceandbeans> lol this is a fool's errand
<havenwood> riceandbeans: Uhhh. 1.8???
<riceandbeans> Dude I know
<riceandbeans> It's in a VM for a test that I JUST spun up with Vagrant and I'm loading in with rbenv
<havenwood> riceandbeans: That's like 15 years ago. ;(
<riceandbeans> I know
<riceandbeans> Rather not get into the why....
<riceandbeans> Suffice to say, I need to just validate I can load like 0.9.10 did_you_mean and that doing that does what I expect
<havenwood> riceandbeans: Yeah, did_you_mean isn't meant for the pre-2.1 world at all.
<havenwood> riceandbeans: Don't run that test. :P
Seich has quit [Ping timeout: 260 seconds]
<riceandbeans> That says 1.9.3
<riceandbeans> So...
<riceandbeans> I don't know.
<riceandbeans> But, I have to validate 1.8.5
<havenwood> riceandbeans: I don't recall a version that old, but maybe it just predates my recollection. Ruby 1.8 to 1.9 had the biggest breaking changes we've ever seen in Ruby.
<riceandbeans> I know, I was there lol
<havenwood> riceandbeans: I hesitate to ask why Ruby 1.8 and did_you_mean are crossing paths.
<riceandbeans> I wasn't using did_you_mean then though :P
<riceandbeans> Wouldn't answer if you did :)
rhe_ has quit [Quit: ZNC - https://znc.in]
braincrash has quit [Ping timeout: 256 seconds]
deadk has quit [Quit: edk]
banisterfiend has quit [Read error: Connection reset by peer]