havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.5, 2.5.7, 2.7.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
<havenwood> sudo su - psilly1; ruby -retc -e "puts Etc.getlogin" #>> pillyorigialnotsu
<havenwood> Etc.getpwuid(Process.uid).name #>> psilly1
<havenwood> Anyway, if they check logs, that's ^ a simple example. of Etc.getlogin being wrong.
<havenwood> Or just: Etc.getpwuid.name
<havenwood> &>> require 'etc'; Etc.getpwuid.name
<rubydoc> # => "ruby" (https://carc.in/#/r/7xhg)
<havenwood> &>> require 'etc'; Etc.getlogin
<rubydoc> # => "ruby" (https://carc.in/#/r/7xhh)
renich_ has joined #ruby
renich has quit [Ping timeout: 268 seconds]
MinSrodowiska has quit [Quit: Bye Bye]
Fernando-Basso has quit [Quit: Leaving]
drincruz_ has joined #ruby
AJA4351 has joined #ruby
mossplix has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
Guest658 has quit [Ping timeout: 240 seconds]
absolutejam2 has quit [Ping timeout: 240 seconds]
renich has joined #ruby
renich_ has quit [Ping timeout: 265 seconds]
Swyper has joined #ruby
renich has quit [Ping timeout: 276 seconds]
teclator has quit [Ping timeout: 265 seconds]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
drincruz_ has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
tomreyn has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
MinSrodowiska has joined #ruby
<tomreyn> hi, sorry for the newbie question but i'm failing to find a proper answer: is it normaly to have those two ruby's in the path to the binary files? ~/.local/share/rubygems/ruby/ruby/2.5.0/bin
<tomreyn> and if not so, how can i make bundler not create this path?
<tomreyn> my expectation would be to rather see a path like ~/.local/share/rubygems/ruby/2.5.0/bin
<tomreyn> this is with ruby 2.5.1p57
<havenwood> tomreyn: How'd you install it?
<tomreyn> Bundler version 1.16.1
<havenwood> tomreyn: Is your `gem env gemdir` as expected: ~/.local/share/rubygems/ruby/ruby/2.5.0
<havenwood> tomreyn: say more about how you setup Ruby and on what kind of system?
drincruz_ has joined #ruby
<tomreyn> havenwood: first of all i rm -r'd ~/.local/share/rubygems, then i did a git checkout of a ruby application (wpscan) and then i ran "bundler", then "bundler install"
<tomreyn> $ gem env gemdir
<tomreyn> /var/lib/gems/2.5.0
jenrzzz has quit [Ping timeout: 276 seconds]
<tomreyn> but i do prefer to keep things in the user scope
phaul has quit [Ping timeout: 265 seconds]
<havenwood> tomreyn: For example, my $GEM_HOME is ~/.gem/ruby/2.7.0 so my bin/ dir is ~/.gem/ruby/2.7.0/bin.
<tomreyn> env | grep -Ei 'RUBY|GEM|BUNDL' returns nothing for me
<tomreyn> should i explicitly set GEM_HOME then? but this does still not explain why i have this ruby/ruby without the explicit declaration
<havenwood> tomreyn: I'm using chruby, which set GEM_HOME. You can set GEM_HOME yourself.
<tomreyn> this is an ubuntu 18.04.3 system, if it matters
<havenwood> tomreyn: You can arbitrarily set the gem home directory. Did you install Ruby with apt?
<havenwood> tomreyn: How'd you install Ruby?
<tomreyn> yes, i installed ruby with apt
<havenwood> tomreyn: I'd leave it be. I'd assume the ruby/ruby is some convention but admittedly I've not noticed that before.
<tomreyn> readlink -f $(which ruby) returns /usr/bin/ruby2.5
MrCrackPotBob has quit [Remote host closed the connection]
<tomreyn> i'm not sure about the convention, i don't see this anywhere else
<havenwood> tomreyn: But yeah, you have RubyGems install wherever you want or alternatively set --path on a per-project basis to have Bundler remember an alternative path.
MrCrackPotBob has joined #ruby
<tomreyn> i rather suspect that i misconfigured it at some point, but don't know where those settings could be stored
tjbp has quit [Remote host closed the connection]
CalimeroTeknik_ has joined #ruby
blackmesa has joined #ruby
CalimeroTeknik has quit [Ping timeout: 250 seconds]
tjbp has joined #ruby
kyrylo has joined #ruby
blackmesa1 has joined #ruby
phaul has joined #ruby
<tomreyn> thanky you!
<tomreyn> err thank you!
Swyper has quit [Remote host closed the connection]
mossplix has joined #ruby
blackmesa has quit [Ping timeout: 276 seconds]
phaul has quit [Ping timeout: 268 seconds]
henninb has joined #ruby
wymillerlinux has quit [Remote host closed the connection]
Nicmavr has quit [Read error: Connection reset by peer]
teclator has joined #ruby
mossplix has quit [Ping timeout: 268 seconds]
Nicmavr has joined #ruby
tpanarch1st has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
teclator has quit [Ping timeout: 240 seconds]
teclator has joined #ruby
phaul has joined #ruby
AJA4351 has joined #ruby
duderonomy has joined #ruby
Swyper has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
AJA4350 has quit [Client Quit]
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
<hahuang65> is there an inverse method of `Enumerable#zip`?
Swyper has quit [Remote host closed the connection]
bvdw has quit [Read error: Connection reset by peer]
<leftylink> hmm. if it's specifically an Array, one can use `Array#transpose` to do the reverse of `Enumerable#zip` for non-arrays... perhaps one would have to do a map.with_object and do it manually
<leftylink> &>> [1, 2, 3].zip([4, 5, 6]).transpose
<rubydoc> # => [[1, 2, 3], [4, 5, 6]] (https://carc.in/#/r/7xid)
bvdw has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
Swyper has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
bambanx has joined #ruby
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has joined #ruby
teclator has quit [Ping timeout: 250 seconds]
eljimbo has joined #ruby
tomreyn has left #ruby [#ruby]
phaul has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
phaul has joined #ruby
mossplix has quit [Ping timeout: 276 seconds]
drincruz has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
titanbiscuit has quit [Quit: ZNC 1.7.4 - https://znc.in]
drincruz_ has quit [Ping timeout: 240 seconds]
titanbiscuit has joined #ruby
phaul has joined #ruby
rubyguy has joined #ruby
drincruz_ has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
drincruz has quit [Ping timeout: 240 seconds]
henninb has quit [Quit: Lost terminal]
phaul has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
drincruz has joined #ruby
drincruz_ has quit [Read error: Connection reset by peer]
drincruz_ has joined #ruby
phaul has joined #ruby
teclator has joined #ruby
drincruz has quit [Ping timeout: 268 seconds]
phaul has quit [Ping timeout: 276 seconds]
ropeney has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
MinSrodowiska has quit [Quit: Bye Bye]
phaul has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
redlegion has quit [Remote host closed the connection]
phaul has quit [Ping timeout: 246 seconds]
bryanhowarth has joined #ruby
Intelo has joined #ruby
phaul has joined #ruby
brool has quit [Ping timeout: 264 seconds]
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
skx86 is now known as NIN
NIN is now known as skx86
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
Swyper has quit [Remote host closed the connection]
phaul has quit [Ping timeout: 240 seconds]
Swyper has joined #ruby
ellcs has quit [Ping timeout: 252 seconds]
phaul has joined #ruby
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 246 seconds]
Swyper has quit [Ping timeout: 265 seconds]
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
jenrzzz has joined #ruby
<adam12> baweaver: Ooh very nice.
phaul has quit [Ping timeout: 276 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
ellcs has joined #ruby
dasher00 has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
<adam12> I wonder with the release of Bazel 1.0, I'll finally get Sorbet on FreeBSD.
phaul has quit [Ping timeout: 240 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix- has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
Swyper has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
roadt has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
phaul has joined #ruby
akemhp_ has joined #ruby
akemhp has joined #ruby
roadt has quit [Ping timeout: 240 seconds]
phaul has quit [Ping timeout: 240 seconds]
akemhp_ has quit [Ping timeout: 268 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadt has joined #ruby
akemhp has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
akemhp has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
akem__ has joined #ruby
xall has joined #ruby
akemhp_ has quit [Ping timeout: 265 seconds]
phaul has quit [Ping timeout: 246 seconds]
phaul has joined #ruby
Swyper has quit [Remote host closed the connection]
<xall> How to write the equivalent in Minitest (from Rspec): `allow(ScoredPlay).to receive(:new) { |score, play| [score, play] }`?
cyclonis has joined #ruby
akemhp_ has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
akem__ has quit [Ping timeout: 246 seconds]
akem__ has joined #ruby
phaul has joined #ruby
akemhp_ has quit [Ping timeout: 265 seconds]
mossplix has joined #ruby
<xall> Seems like it might not be possible for Minitest mocks to return whatever is given. The docs show that the return value is explicitly required.
phaul has quit [Ping timeout: 276 seconds]
akemhp_ has joined #ruby
<xall> so i guess the solution is to manually stub it out
phaul has joined #ruby
akem__ has quit [Ping timeout: 276 seconds]
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 268 seconds]
phaul has quit [Ping timeout: 276 seconds]
mossplix has quit [Remote host closed the connection]
phaul has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
akem__ has quit [Ping timeout: 240 seconds]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 240 seconds]
akemhp_ has joined #ruby
mossplix has joined #ruby
jenrzzz has joined #ruby
akem__ has quit [Ping timeout: 240 seconds]
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
mossplix has quit [Ping timeout: 265 seconds]
sphex has joined #ruby
Intelo has quit [Ping timeout: 268 seconds]
akemhp has joined #ruby
jenrzzz has joined #ruby
akem__ has quit [Ping timeout: 265 seconds]
akemhp_ has joined #ruby
akem__ has joined #ruby
akemhp has quit [Ping timeout: 250 seconds]
akemhp_ has quit [Ping timeout: 240 seconds]
cd has joined #ruby
conta has joined #ruby
akem__ has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
Intelo has joined #ruby
bambanx has quit [Quit: Leaving]
DarthGandalf has quit [Ping timeout: 250 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
DarthGandalf has joined #ruby
dajonker has joined #ruby
<dajonker> 2
jenrzzz has joined #ruby
xall has quit [Ping timeout: 265 seconds]
schne1der has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
Intelo has quit [Ping timeout: 265 seconds]
xall has joined #ruby
dajonker has quit [Ping timeout: 265 seconds]
roadt has quit [Ping timeout: 276 seconds]
roadt has joined #ruby
tpanarch1st has quit [Ping timeout: 240 seconds]
xall has quit [Ping timeout: 250 seconds]
xall has joined #ruby
mossplix has quit [Ping timeout: 240 seconds]
schne1der has quit [Ping timeout: 265 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xall has quit [Read error: Connection reset by peer]
mossplix has joined #ruby
xall has joined #ruby
mossplix has quit [Remote host closed the connection]
xall has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
Intelo has joined #ruby
dellavg has joined #ruby
dirk1 has joined #ruby
dirk1 is now known as dajonker
xall has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
xall has quit [Client Quit]
bvdw has joined #ruby
Intelo has quit [Ping timeout: 245 seconds]
absolutejam2 has joined #ruby
bitwinery has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 268 seconds]
banisterfiend has joined #ruby
banisterfiend has quit [Client Quit]
TomyWork has joined #ruby
blackmesa has joined #ruby
roadt has quit [Ping timeout: 265 seconds]
tpanarch1st has joined #ruby
roadt has joined #ruby
jenrzzz has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
jmcgnh has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
GodFather has quit [Ping timeout: 240 seconds]
Fernando-Basso has joined #ruby
jacksoow has quit [Ping timeout: 264 seconds]
poontangmessiah has joined #ruby
DTZUZO has joined #ruby
jacksoow has joined #ruby
akemhp_ has joined #ruby
Intelo has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
jacksoow_ has joined #ruby
jacksoow has quit [Ping timeout: 265 seconds]
DTZUZO has quit [Remote host closed the connection]
absolutejam2 has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
dellavg has quit [Ping timeout: 268 seconds]
ropeney has quit [Ping timeout: 240 seconds]
roadt has quit [Ping timeout: 250 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
roadt has joined #ruby
lxsameer has joined #ruby
phaul_ has joined #ruby
DTZUZO has joined #ruby
akemhp has joined #ruby
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 268 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
akemhp has quit [Ping timeout: 246 seconds]
akemhp_ has joined #ruby
roadt has quit [Ping timeout: 268 seconds]
akem__ has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
tvw has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
NL3limin4t0r_afk is now known as NL3limin4t0r
AJA4350 has joined #ruby
DTZUZO has quit [Ping timeout: 246 seconds]
tvw has quit []
akem__ has joined #ruby
yann-kaelig has joined #ruby
akemhp_ has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
poontangmessiah has quit [Read error: Connection reset by peer]
ropeney has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
phaul_ has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
chrisco has joined #ruby
ellcs has joined #ruby
phaul_ has joined #ruby
DTZUZO has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
akem__ has quit [Quit: Leaving]
akemhp has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
DTZUZO has quit [Ping timeout: 240 seconds]
phaul_ has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
al2o3-cr has quit [Quit: WeeChat 2.6]
suukim has joined #ruby
phaul_ has joined #ruby
MinSrodowiska has joined #ruby
al2o3-cr has joined #ruby
AJA4351 has joined #ruby
Jonopoly has joined #ruby
akemhp_ has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
akemhp has quit [Ping timeout: 265 seconds]
chrisco has quit []
akemhp has joined #ruby
jenrzzz has joined #ruby
<Cork> anyone here managed to use WinRM to control a windows ad server?
<Cork> been trying to get it to work but it gives me a ton of problems
akemhp_ has quit [Ping timeout: 240 seconds]
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
MinSrodowiska has quit [Quit: Bye Bye]
phaul_ has quit [Ping timeout: 240 seconds]
phaul_ has joined #ruby
<NL3limin4t0r> I'v used WinRM in a project to query a Windows only application via a powershell command.
<NL3limin4t0r> What's your current issue?
<NL3limin4t0r> Never tried anything with an ad server though.
cyclonis_ has joined #ruby
cyclonis has quit [Ping timeout: 265 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
ahmadn has joined #ruby
hiroaki has joined #ruby
<ahmadn> Hello all. I have a quick Q. I am using omniauth and seeing that it correctly redirects to the callback url and everything working just fine. However I am noticing that sensitive data (such as state, token, etc) are being passed to the callback as query parameters. URLs get logged in many places. Isn't this a security risk?
<ahmadn> googling this didn't return anything useful.
cyclonis_ has quit [Ping timeout: 252 seconds]
mossplix has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 has joined #ruby
AJA4351 is now known as AJA4350
MinSrodowiska has joined #ruby
schne1der has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
lineus has joined #ruby
jacksoow_ has quit [Ping timeout: 240 seconds]
Nicmavr has joined #ruby
jacksoow has joined #ruby
will- has joined #ruby
nowhere_man has quit [Ping timeout: 265 seconds]
will- is now known as alotofnoodles
sphex has quit [Ping timeout: 276 seconds]
sphex has joined #ruby
phaul_ has quit [Ping timeout: 246 seconds]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
phaul_ has joined #ruby
alotofnoodles has quit [Remote host closed the connection]
AJA4351 is now known as AJA4350
skx86 has quit [Quit: Connection closed for inactivity]
MinSrodowiska has quit [Quit: Bye Bye]
drincruz_ has quit [Ping timeout: 276 seconds]
sandstrom has joined #ruby
sphex has quit [Ping timeout: 268 seconds]
tvw has joined #ruby
AJA4351 has joined #ruby
jacksoow has quit [Quit: Saindo...]
jacksoow has joined #ruby
deadk is now known as e
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
Fira has quit [Read error: Connection reset by peer]
Fira has joined #ruby
chalkmonster has joined #ruby
ahmadn has quit [Remote host closed the connection]
ahmadn has joined #ruby
cd has quit [Ping timeout: 265 seconds]
ahmadn has left #ruby [#ruby]
ahmadn has joined #ruby
ahmadn has quit [Remote host closed the connection]
phaul_ has quit [Ping timeout: 264 seconds]
cd has joined #ruby
absolutejam2 has joined #ruby
will` has joined #ruby
will` is now known as alotofnoodles
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
jacksoow has quit [Read error: Connection reset by peer]
alotofnoodles has quit [Quit: rcirc on GNU Emacs 26.2]
lucasb has joined #ruby
hutch1 has joined #ruby
cd has quit [Quit: cd]
stryek has joined #ruby
jacksoow has joined #ruby
cd has joined #ruby
absolutejam2 has quit [Ping timeout: 276 seconds]
Jonopoly has quit [Ping timeout: 268 seconds]
TomyLobo2 has joined #ruby
TomyLobo2 has quit [Remote host closed the connection]
Jonopoly has joined #ruby
ravenousmoose has joined #ruby
tvw has quit []
tvw has joined #ruby
alfiemax has joined #ruby
tvw has quit [Client Quit]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
vondruch has quit [Ping timeout: 240 seconds]
CalimeroTeknik_ has quit [Quit: バイバイ]
nowhere_man has joined #ruby
CalimeroTeknik has joined #ruby
drincruz_ has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
shirak_ has joined #ruby
phaul_ has joined #ruby
phaul_ has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 276 seconds]
chalkmonster has quit [Quit: WeeChat 2.6]
eein[m] has quit [Quit: 30 day idle timeout.]
chalkmonster has joined #ruby
nowhere_man has quit [Ping timeout: 276 seconds]
shirak_ has quit [Ping timeout: 265 seconds]
MinSrodowiska has joined #ruby
akemhp_ has joined #ruby
phaul_ has joined #ruby
akemhp has quit [Ping timeout: 265 seconds]
AJA4351 has joined #ruby
conta has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
dajonker has quit [Ping timeout: 245 seconds]
vondruch has joined #ruby
nowhere_man has joined #ruby
Swyper has joined #ruby
leitz has joined #ruby
skx86 has joined #ruby
tpanarch1st_ has joined #ruby
tpanarch1st has quit [Ping timeout: 240 seconds]
poontangmessiah has joined #ruby
poontangmessiah_ has joined #ruby
poontangmessiah has quit [Ping timeout: 240 seconds]
teardown has quit [Quit: leaving]
beanie__ has joined #ruby
phaul_ has quit [Ping timeout: 240 seconds]
tpanarch1st_ has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
teardown has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
teardown has left #ruby [#ruby]
pabs has quit [Ping timeout: 265 seconds]
pabs has joined #ruby
MinSrodowiska has quit [Quit: Bye Bye]
TomyWork has quit [Remote host closed the connection]
jacksoow has quit [Ping timeout: 265 seconds]
TomyWork has joined #ruby
Inline__ has joined #ruby
nowhere_man has quit [Ping timeout: 246 seconds]
Inline has quit [Ping timeout: 264 seconds]
TomyWork has quit [Remote host closed the connection]
TomyWork has joined #ruby
jacksoow has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
bryanhowarth has quit [Quit: sleep | bryan.howarth@gmail.com | twitter.com/bryanhowarth]
sandstrom has quit [Ping timeout: 246 seconds]
Intelo has quit [Ping timeout: 264 seconds]
beanie__ has quit [Ping timeout: 240 seconds]
mossplix has quit [Ping timeout: 276 seconds]
mossplix has joined #ruby
mossplix has quit [Remote host closed the connection]
alfiemax has quit []
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
Swyper has quit [Remote host closed the connection]
jmcgnh has quit [Read error: Connection reset by peer]
jmcgnh has joined #ruby
SeepingN has joined #ruby
phaul_ has joined #ruby
poontangmessiah_ has quit [Remote host closed the connection]
Guest658 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
Guest658 is now known as davidw
davidw has quit [Changing host]
davidw has joined #ruby
phaul_ has quit [Ping timeout: 264 seconds]
mossplix has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
mossplix has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 246 seconds]
mozzarella has quit [Ping timeout: 240 seconds]
akem__ has quit [Ping timeout: 264 seconds]
blackmesa has joined #ruby
kx has joined #ruby
phaul_ has joined #ruby
cthulchu_ has joined #ruby
mossplix has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
mossplix has quit [Remote host closed the connection]
Intelo has joined #ruby
phaul_ has quit [Client Quit]
ellcs has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
Intelo_ has joined #ruby
Intelo has quit [Ping timeout: 268 seconds]
chalkmonster has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Jonopoly has quit [Ping timeout: 268 seconds]
MinSrodowiska has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
mossplix has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
AJA4350 has joined #ruby
TomyWork has quit [Remote host closed the connection]
Intelo_ has quit [Quit: Leaving]
Intelo has joined #ruby
dasher00 has joined #ruby
<davidw> I went ahead and filed a bug... https://bugs.ruby-lang.org/issues/16288 - it's kind of fun to chase this stuff down
banisterfiend has joined #ruby
orbyt_ has joined #ruby
banisterfiend has quit [Client Quit]
mozzarella has joined #ruby
bitwinery has joined #ruby
rippa has joined #ruby
psilly0 has joined #ruby
cadeskywalker has quit [Ping timeout: 276 seconds]
schne1der has quit [Ping timeout: 265 seconds]
dionysus69 has joined #ruby
<adam12> davidw: Interesting bug report. Only on 2.6.6?
jenrzzz has quit [Ping timeout: 245 seconds]
<davidw> adam12, I see it with 2.5 too
<adam12> davidw: Running that test code triggers it?
mossplix has quit [Remote host closed the connection]
MinSrodowiska has quit [Quit: Bye Bye]
banisterfiend has joined #ruby
Xiti has quit [Quit: Xiti]
<davidw> adam12, no, running the sample rails app I have does. I need to clean that up just a bit and attach it
<davidw> I couldn't get a really simple test case :-/
Xiti has joined #ruby
jenrzzz has joined #ruby
mossplix has joined #ruby
leam_ has joined #ruby
cadeskywalker has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
Intelo_ has joined #ruby
Intelo has quit [Disconnected by services]
Intelo_ has left #ruby [#ruby]
jenrzzz has joined #ruby
leitz has quit [Ping timeout: 265 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 240 seconds]
dajonker has joined #ruby
paraxial has quit [Quit: The Lounge - https://thelounge.chat]
paraxial has joined #ruby
banisterfiend has joined #ruby
fig-le-deunch has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
paraxial has quit [Ping timeout: 276 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
barg has joined #ruby
<barg> is it possible that gem list | grep sinatra doesn't show anything.. then I make a Gemfile that includes gem 'sinatra' and I do bundle install.. Then when I leave that directory and do gem list, that it shows sinatra?
<barg> i'd have thought it wouldn't show outside of that directory 'cos i thought bundle install would only install the gem locally
<adam12> barg: It doesn't install locally, unless you tell it to. There's a variety of ways, from --path to `bundle` and `BUNDLE_PATH` environment variable.
<adam12> barg: But by default, it installs to `GEM_HOME`
dajonker has quit [Ping timeout: 240 seconds]
psilly0 has quit [Quit: psilly0]
paraxial has joined #ruby
psilly0 has joined #ruby
<barg> thanks.. strange thing also is i had some directories with a Gemfile that mentioned sinatra.. I guess I hadn't done bundle install on such a Gemfile before?
jenrzzz has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> barg: Possibly.
<barg> how might it be possible I could have used sinatra before but not had the gem installed?
<barg> maybe I reinstalled ruby and lost those gems, that's one possibility
Benett has joined #ruby
orbyt_ has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
mossplix has quit [Ping timeout: 268 seconds]
Exuma has joined #ruby
fig-le-deunch has quit [Quit: Konversation terminated!]
AJA4351 has joined #ruby
psilly0 has quit [Quit: psilly0]
jbeaudoin_sher has quit [Quit: Connection closed for inactivity]
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
jenrzzz has joined #ruby
poontangmessiah has joined #ruby
leam_ is now known as leam
hutch1 has quit [Ping timeout: 250 seconds]
mossplix has joined #ruby
jacksoow_ has joined #ruby
hutch1 has joined #ruby
jacksoow has quit [Ping timeout: 276 seconds]
mossplix has quit [Ping timeout: 240 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
mossplix has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
blackmesa has quit [Ping timeout: 245 seconds]
<NL3limin4t0r> barg: If you use RVM it might be because you switch Ruby versions. Each Ruby version has it's own gems installed (although minor Ruby versions might share gems).
<NL3limin4t0r> ^ 2.4.0 might use the same $GEM_HOME as 2.4.1 for example.
<NL3limin4t0r> However 2.4.0 and 2.5.0 most likely won't.
sameerynho has joined #ruby
<NL3limin4t0r> > echo $GEM_HOME #=> /home/johwen/.rvm/gems/ruby-2.4.1
<NL3limin4t0r> and when I swap to another directory
<NL3limin4t0r> > echo $GEM_HOME #=> /home/johwen/.rvm/gems/ruby-2.6.1
<jfhbrook> I got a weird one: I noticed that my rbenv-installed ruby 2.5.7 was using the 2.6.0 gems folder
<jfhbrook> like it was all working 🤷‍♂️ but it's extremely weird and I'm sure something is going to break on me eventually
jenrzzz has quit [Ping timeout: 245 seconds]
shirak_ has joined #ruby
renich has joined #ruby
AJA4350 has joined #ruby
<NL3limin4t0r> Here you can see that 2.5.1 and 2.5.3 share the same $GEM_HOME behind the screens https://i.imgur.com/PTtYPMQ.png
<NL3limin4t0r> jfhbrook: That's indeed kinda strange.
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
<jfhbrook> yeah, it's bizarre. no idea how or why it would do that, don't know enough about how rbenv and rubygems work yet
robotcars has joined #ruby
robotcars has left #ruby [#ruby]
knueppelspass has joined #ruby
Benett has quit [Remote host closed the connection]
blackmesa has joined #ruby
Benett has joined #ruby
mossplix has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
<havenwood> jfhbrook: RubyGems uses the Ruby ABI number, which these days is MAJOR.MINOR.0.
chalkmonster has quit [Quit: WeeChat 2.6]
AJA4351 has joined #ruby
<havenwood> (Ruby 1.9's ABI was 1.9.1, iir.)
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
mossplix has quit [Remote host closed the connection]
suukim has quit [Quit: Konversation terminated!]
mossplix has joined #ruby
<leftylink> oh hmm. this is not really about Ruby, it is more about regular expressions, but I'm not in #regexp so this is the only place I am in to talk about it
<leftylink> &>> /|/
<rubydoc> # => /|/ (https://carc.in/#/r/7xq6)
<leftylink> I was surprised to know that that is a valid regexp. but it makes sense I guess
<leftylink> since /A|/ is valid, obviously /|/ would be valid too
<leftylink> "obviously"
jenrzzz has joined #ruby
<leftylink> it was probably not obvious if I only just found out about it
<leftylink> only obvious in hindsight.
<havenwood> leftylink: it matches empty OR empty
<havenwood> &>> /||/ # empty or empty or empty
<rubydoc> # => /||/ (https://carc.in/#/r/7xq7)
mossplix has quit [Ping timeout: 265 seconds]
<havenwood> &>> /||/s # case insensitive empty or empty or empty
<rubydoc> # => /||/ (https://carc.in/#/r/7xq8)
<havenwood> :P
phaul has quit [Ping timeout: 240 seconds]
<leftylink> luckily, ruby String#split, when given a string, will not silently convert it to a regular expression. woe betide any languages whose String#split equivalent does.
<leftylink> when they try to split on a single pipe
<leftylink> they are in for a nasty nasty surprise
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
lucasb has quit [Quit: Connection closed for inactivity]
<leftylink> ... and predictably, there are stack overflow questions about why splitting on a single pipe in that(/those) language(s) do(es) not work
<leftylink> er, wait, "does" is always the correct word in that sentence
<leftylink> ... and predictably, there are stack overflow questions about why splitting on a single pipe in that(/those) language(s) does not work
Kilo`byte has joined #ruby
<NL3limin4t0r> Is that language JS?
<NL3limin4t0r> Never mind, just tested it out and JS doesn't silently convert strings in split to a regex.
phaul has joined #ruby
phaul has quit [Ping timeout: 264 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
dinfuehr has quit [Ping timeout: 268 seconds]
dinfuehr has joined #ruby
AJA4351 has joined #ruby
phaul has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
bvdw has quit [Read error: Connection reset by peer]
phaul has quit [Ping timeout: 240 seconds]
bvdw has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
phaul has joined #ruby
iq has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
cadeskywalker has quit [Quit: WeeChat 1.6]
cadeskywalker has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
iq has quit [Quit: Leaving]
xco has joined #ruby
AJA4351 has joined #ruby
phaul has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
poontangmessiah_ has joined #ruby
<jfhbrook> I haven't seen that anywhere
<jfhbrook> I work with javascript and python and have done scala in a past role
<jfhbrook> bash kinda doesn't count cause it doesn't have a regexp type anyway
<jfhbrook> I'd be curious to know perl's behavior - will learn someday
phaul has quit [Ping timeout: 265 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
poontangmessiah has quit [Ping timeout: 265 seconds]
<Rudolph> bash only has string types, but in [[ =~ ]] they're converted to a regex anyways
poontangmessiah has joined #ruby
poontangmessiah_ has quit [Ping timeout: 245 seconds]
Inline__ has quit [Quit: Leaving]
Inline has joined #ruby
phaul has joined #ruby
psilly0 has joined #ruby
<psilly0> Hello - Is there a way to spoof [Etc.getlogin] so i can change the User it displays to me? Maybe some system variable?
<Rudolph> havenwood: ^
<havenwood> sudo su - psilly1; ruby -retc -e "puts Etc.getlogin" #>> pillyorigialnotsu
<havenwood> psilly0: Try that ^
<havenwood> psilly0: Compare with: Etc.getpwuid(Process.uid).name #>> psilly1
<psilly0> thanks havenwood, sorry about yesterday i had to run and quit IRC
<psilly0> let me try this
<havenwood> Rudolph: thanks :)
<Rudolph> np :>
phaul has quit [Ping timeout: 240 seconds]
poontangmessiah_ has joined #ruby
<psilly0> hmmm still showing the orginal user i started the SSH session with
poontangmessiah has quit [Ping timeout: 265 seconds]
<leftylink> that seems to be consistent with the claimed behaviour of "pillyorigialnotsu" - "originalnotsu" seems to imply that it'd be the original user the SSH session was started with
phaul has joined #ruby
<havenwood> psilly0: you switched users, and that isn't reflected - hence wrong
animo8 has joined #ruby
<havenwood> psilly0: Just an example of it being wrong
<psilly0> i see
dionysus69 has quit [Ping timeout: 265 seconds]
dionysus70 has joined #ruby
<psilly0> is there a way to change Etc.getlogin to something custom i want
<psilly0> i logged in with psilly0
<psilly0> i want etc.getlogin to display psilly7
<leftylink> anything can be changed to whatever you want, really
<leftylink> &>> require 'etc'; module IAmSam refine Etc.singleton_class do def getlogin; 'sam' end end end; using IAmSam; p Etc.getlogin
<rubydoc> # => "sam"... check link for more (https://carc.in/#/r/7xrl)
Exuma has quit [Quit: Textual IRC Client: www.textualapp.com]
<leftylink> now you're sam, congrats
<psilly0> let me try
phaul has quit [Ping timeout: 240 seconds]
dionysus70 is now known as dionysus69
<leftylink> so basically, the same way you would change any other function to return whatever you wnt
<leftylink> write the code for the function in such a wy.
<leftylink> s/wy/way/
AJA4351 has joined #ruby
<animo8> Hi, I'm writing a Befunge interpreter and am facing an issue that's a bit hard to explain
<animo8> I need to call a private instance method from a class instance lambda variable that takes self as a parameter, or find a better design
<animo8> Should I send a gist of my code? it's a bit over 100 lines
dionysus69 has quit [Quit: dionysus69]
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
yann-kaelig has quit [Quit: yann-kaelig]
chalkmonster has joined #ruby
<psilly0> member:leftylink if thats the case ill just define a new function to pull from ENV variable $USER
<adam12> animo8: 100% use a gist. And make it easily reproducable. Ala, I can download it, run it here, and see any error if possible. Not many people want to parse through 100 lines of unfamiliar code :)
skx86 has quit [Quit: Connection closed for inactivity]
<psilly0> thanks for your help dude
<leftylink> perhaps it is useful to say that `send` can call private methods. I make no judgment as to whether it's a good idea to do so, but possible.
<leftylink> &>> class A; class << self; attr_reader :f end; @f = ->i { i.send(:foo) }; private def foo; :foo_called end end; p A.f[A.new]
<rubydoc> # => :foo_called... check link for more (https://carc.in/#/r/7xro)
phaul has joined #ruby
MinSrodowiska has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
<leftylink> also imagine my surprise when refine says `TypeError: wrong argument type Module (expected Class)` ... luckily stack overflow came to the rescue to show how it could be done
phaul has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
SanguineAnomaly has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
SanguineAnomaly has joined #ruby
gix has joined #ruby
<havenwood> animo8: Sounds like there might be a better design. :)
<animo8> havenwood: Probably. I'm trimming it and making it self-contained and then I'll upload it to gist
wildtrees has joined #ruby
blackmesa1 has joined #ruby
bobdobbs` has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
blackmesa has quit [Ping timeout: 245 seconds]
leam has quit [Quit: Leaving]
AJA4351 has joined #ruby
Exuma has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
bobdobbs has quit [Ping timeout: 245 seconds]
poontangmessiah_ has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
poontangmessiah has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
poontangmessiah_ has joined #ruby
phaul has joined #ruby
<animo8> The problematic lines are 73 - 76
poontangmessiah has quit [Ping timeout: 265 seconds]
<animo8> Because this is a megaclass one option would be to move the instructions hash to an instance variable and initialize it in the constructor, but that bloats the constructor (is that a bad thing?)
lxsameer has quit [Ping timeout: 240 seconds]
<animo8> I don't think I'll ever have more than 1 instance of `Interpreter` so that's actually a feasible thing to do, but if I do that I'd prefer to make sure only one instance of `Interpreter` is active at any given time. Is that doable or should I just trust the programmer to use it correctly?
phaul has quit [Ping timeout: 276 seconds]
poontangmessiah has joined #ruby
<animo8> Also expanding on the initializer bloat issue, if I do init `@instructions` in the initializer Rubocop complains because the method is too long. Should I just mute that warning or is there a more idiomatic solution?
poontangmessiah_ has quit [Ping timeout: 240 seconds]
poontangmessiah has quit [Remote host closed the connection]
MinSrodowiska has quit [Quit: Bye Bye]
MinSrodowiska has joined #ruby
phaul has joined #ruby
<leftylink> I will mention that a `case` inside `step` would be able to handle the instructions, but I understand if it is done the way it is done (`instructions` hash) for some performance reason. I will have to trust that the performance was found to be important at that part
schne1der has joined #ruby
<havenwood> animo8: Use a constant rather than class instance variable.
<havenwood> animo8: INSTRUCTIONS =
<havenwood> animo8: If you don't want to expose it externally, chase it with: private_constant :INSTRUCTIONS
phaul has quit [Ping timeout: 240 seconds]
<havenwood> animo8: s.send(:direction=, Directions::RIGHT)
<animo8> leftylink: This way it's extendable at runtime (not useful for this language but I once tried to implement a forth-like language that could define new instructions/words). Also it just looks cleaner to me
blackmesa has joined #ruby
<animo8> havenwood: The constant solution is actually brilliant, no idea why I didn't think of that. Way simpler than my current kludge
<havenwood> animo8: I'd use #fetch instead of #[] when you know it exists
blackmesa1 has quit [Ping timeout: 252 seconds]
<havenwood> animo8: INSTRUCTIONS.fetch(@cursor).call(self)
knueppelspass has quit [Remote host closed the connection]
<havenwood> animo8: Freeze INSTRUCTIONS for good measure
<animo8> havenwood: Doesn't your `send` solution violate encapsulation? I'd rather have as little ugly non-idiomatic code as possible and this just seems like a recipe for more trouble down the road
jenrzzz has joined #ruby
<havenwood> animo8: Yes, was pondering which way to suggest "fixing" it but multitasking atm.
<havenwood> animo8: Just `exit` is `exit 0` and that's known so just `exit`. If you want error status, `abort` instead.
rrichardsr3 has joined #ruby
<animo8> havenwood: IMO the explicit exit code is more readable
AJA4351 has joined #ruby
<animo8> What do you mean by "error status"? AFAIK exit is for numeric exit codes and abort is for exit messages. Am I right?
<havenwood> animo8: Sure, it's fine. Like `return` in bash though I'd flag it in code review to use the default.
<havenwood> `return` instead of `return $?` even though the latter is explicit
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
phaul has joined #ruby
<havenwood> animo8: #abort is for a 1 exit status. if you pass an argument it'll STDERR it.
<animo8> havenwood: Hmm, nowadays I mostly write fish for shell config and <insert real language> for actual programs so my bash is kind of rusty. But I see what you mean
<animo8> havenwood: I see. Good to know about #abort!
<havenwood> animo8: So `exit` is for an exit status of 0 and `abort` is for an exit status of 1. if you need a specific non-zero/one exit status you can use `exit`. It's a nit in any case.
drincruz_ has quit [Ping timeout: 245 seconds]
<havenwood> animo8: #warn is nice to use over $stderr.puts since it respects -W warning level flags.
<havenwood> animo8: It's not *really* breaking encapsulation since you're calling from the inside—but still awkward.
<animo8> Yeah. I prefer the more idiomatic and prettier solution
phaul has quit [Ping timeout: 240 seconds]
<havenwood> animo8: You could define private methods for each and return the symbol from each lambda.
<havenwood> animo8: That's probably closest to current design.
<havenwood> animo8: Then use metaprogramming to DRY up declaration of the private methods.
<animo8> I'll just make instructions a top level global
<havenwood> animo8: Don't define your own global variables.
<havenwood> animo8: Use constants.
<havenwood> animo8: It's pretty much an anti-pattern in Ruby to define your own class or global variables.
<animo8> I see. So just a regular constant
<havenwood> animo8: A regular constant with a frozen hash, keys pointing only to method name Symbols.
<leftylink> the question asked was to call a private method. of course we are going to see things like `send`. otherwise, what? you can refine in an attr_writer, I guess?????
<leftylink> &>> class A attr_reader :v; module AW refine A do attr_writer :v end end; using AW; SET = ->s { s.v = 5 } end; A::SET[a = A.new]; a.v
<rubydoc> # => 5 (https://carc.in/#/r/7xrt)
<animo8> Wait a second, now that I think about it making instructions a constant still doesn't fix my problem because it needs to call `direction=` on the Interpreter instance
<animo8> So the solution is to either make instructions an instance var (acceptable) or violate encapsulation (maybe acceptable?)
<havenwood> animo8: {'0' => :instruction_0, '>' => :instruction_right}
<animo8> havenwood: Oh, now I see what you meant. I'll have a go at implementing it
<havenwood> animo8: public_send INSTRUCTIONS.fetch('>'), self
rainmanjam has joined #ruby
<havenwood> animo8: Then metaprogram away the definition of 0-9
<havenwood> '0'.upto('9').each { define_method ...
blackmesa1 has joined #ruby
<leftylink> &>> class A attr_reader :v; module AW refine A do attr_writer :v end end; using AW; SET = ->s { s.v = 5 } end; A::SET[a = A.new]; [a.v, ((a.v = 777) rescue :couldnt_set)]
<rubydoc> # => [5, :couldnt_set] (https://carc.in/#/r/7xrx)
<leftylink> confrming that the SET can set, but outside code can't
<leftylink> since it's not using AW ("A Writer")
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 246 seconds]
<leftylink> eh, better confirm that a.v's value is still safe after the set attempt
<leftylink> &>> class A attr_reader :v; module AW refine A do attr_writer :v end end; using AW; SET = ->s { s.v = 5 } end; A::SET[a = A.new]; [a.v, ((a.v = 777) rescue :couldnt_set), a.v]
<rubydoc> # => [5, :couldnt_set, 5] (https://carc.in/#/r/7xry)
<leftylink> ok
phaul has joined #ruby
<animo8> leftylink: That's actually pretty clever as well, but seeing as I might need to set other variables from instructions I think I'd rather implement instructions as instance methods and store their names as symbols in a constant `INSTRUCTIONS` hash
phaul has quit [Ping timeout: 265 seconds]
al2o3-cr has quit [Quit: WeeChat 2.6]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
phaul has joined #ruby
al2o3-cr has joined #ruby
cloaked1 has joined #ruby
cloaked1 has quit [Changing host]
cloaked1 has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
jenrzzz has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
absolutejam2 has joined #ruby
Scriptonaut has left #ruby [#ruby]
Nicmavr has quit [Read error: Connection reset by peer]
chalkmonster has joined #ruby
Nicmavr has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
phaul has joined #ruby
brool has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sandstrom has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
phaul has joined #ruby
davidw has quit [Ping timeout: 268 seconds]
gdonald has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
phaul has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
davidw has joined #ruby
davidw is now known as Guest1714
phaul has quit [Ping timeout: 268 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
<animo8> Hi again, I implemented the design havenwood suggested and am now facing another problem that I can't figure out how to debug
phaul has joined #ruby
<animo8> Sorry to be dumping code again, but here's the gist with the program and the error https://gist.github.com/omrisim210/2ee77e6a2133e14303ed68b950626cd0
<animo8> Ruby seems to be complaining about an arity error in the block I pass to `define_method` (at least that's what I understand from the error)
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
sandstrom has quit [Quit: My computer has gone to sleep.]
MinSrodowiska has quit [Quit: Bye Bye]
phaul has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
cd has quit [Quit: cd]
Ai9zO5AP has quit [Quit: WeeChat 2.5]
phaul has joined #ruby
<leftylink> since there's only one public_send, this should be pretty easy to track down
cloaked1 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
rrichardsr3 has quit [Quit: He who dares .... wins.]
phaul has quit [Ping timeout: 265 seconds]
<animo8> leftylink: So you're saying the arity error is in `public_send`? That's not what I understand from the error message
<leftylink> Directions.constants.each do |name|
<leftylink> @direction = Directions.const_get(name)
<leftylink> end
<leftylink> define_method "instruction_#{name.to_s.downcase}".to_sym do
<leftylink> oops
<leftylink> wrong paste
<leftylink> 1: from ./befunge.rb:144:in `public_send'
<leftylink> seems pretty unambiguous to me
<havenwood> animo8: you can skip #to_sym there
phaul has joined #ruby
endorama has joined #ruby
<animo8> Huh, I was looking at the last line of the error but after tinkering with pry it seems that leftylink is right. Whoops!
<animo8> havenwood: Thanks for the tip, will do that
<havenwood> animo8: looking at it in use, I'd say switch to: 10.times do |n|
<animo8> Why is `#to_sym` not necessarry though? Does `define_method` implicitly call it?
<animo8> havenwood: I can see how `times` might look better than `upto` but is there a functional difference?
<havenwood> animo8: yes, it'll be integers - but that's nicer
<havenwood> animo8: hmm
<havenwood> yeah
<havenwood> animo8: it's like: 0.upto(90
<havenwood> animo8: it's like: 0.upto(9)
<animo8> Oh right, I forgot I was operating on strings
<havenwood> animo8: 10.times { |n| define_method("instruction_#{n}") { @stack.push(n) } }
<animo8> I'm just gonna have to call `to_s` when defining the method instead of `to_i` when pushing the number but whatever, I'll change it
<havenwood> animo8: #{} is a to_s
<animo8> Oh right, interpolation
<animo8> Yup
<havenwood> animo8: And no String is allocated, so that's a good solution.
<havenwood> no extra string*
phaul has quit [Ping timeout: 265 seconds]
<animo8> Huh. It seems harder to keep track of allocations in Ruby than in C++ or Rust
<animo8> Well, thanks for the help
<havenwood> use the magic comment; # frozen_string_literal: true
<havenwood> animo8: nnp
<animo8> havenwood: I do use it, rubocop warns me if I don't
<havenwood> 👍🏽
jenrzzz has joined #ruby
<havenwood> animo8: I'd put INSTRUCTIONs inside Interpreter class.
<animo8> Or I could make it private as it's not useful for any other code
<havenwood> animo8: From the outside, it'll be Interpreter::INSTRUCTIONs and from the inside just Interpreter.
<havenwood> animo8: Yeah, private inside Interpreter is reasonable.
<havenwood> But not top level.
<havenwood> animo8: It looks like Directions should be inside Interpreter too, but maybe that's just lost in translation from the full one.
duderonomy has joined #ruby
<animo8> No, that's the whole thing. I'm quite slow :p
<havenwood> animo8: You ca ndo: `@cursor = @grid.dig(0, 0)` instead of `@cursor = @grid[0][0]` to save a method call.
jenrzzz has quit [Ping timeout: 268 seconds]