<vyrus001>
/usr/lib64/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require': libffi.so.6: cannot open shared object file: No such file or directory - /home/vyrus/.gem/ruby/2.4.0/gems/ffi-1.9.18/lib/ffi_c.so (LoadError)
thunderbirdtr has quit [Quit: ZNC 1.7.2 - https://znc.in]
thunderbirdtr has joined #ruby
jottr has joined #ruby
cgfbee has quit [Ping timeout: 252 seconds]
_joes_ has quit [Ping timeout: 250 seconds]
TvL2386 has quit [Ping timeout: 245 seconds]
_joes_ has joined #ruby
jottr_ has joined #ruby
cgfbee has joined #ruby
jottr has quit [Read error: Connection reset by peer]
jottr has joined #ruby
lele has quit [Ping timeout: 255 seconds]
jottr_ has quit [Ping timeout: 250 seconds]
TvL2386 has joined #ruby
dsmythe has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 264 seconds]
darklajid has joined #ruby
dsmythe has joined #ruby
jenrzzz has joined #ruby
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
<darklajid>
Hey there. I .. don't really know ruby, but recently got asked (interview) to build a simple console application that is evaluated by a rspec testsuite. I did this in dotnet core. Unfortunately it seems the rspec code fails to read my stdout and now I wanna figure out why.
teclator has joined #ruby
<darklajid>
https://pastebin.com/fX3WCB3A is the code that 1) returns the correct output, if I launch my console application directly (.net assembly) 2) returns [] if I launch the very same console application in a docker container 3) returns [] if I launch the very same code via dotnet run
<darklajid>
All three invocations produce exactly the same output on the command line if launched interactively - but 2 out of 3 end up as empty array of lines in the Ruby code above. Is there anything I could tinker with to figure out why that might be the case?
fphilipe has joined #ruby
hairedfox has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
<hairedfox>
hi everyone
<hairedfox>
I'm new here
al2o3-cr has joined #ruby
<darklajid>
Basically pty = PTY.spawn("executable_here") w/ the code above works differently depending if the executable launches docker or dotnet run for some reason and I don't see any visible change..
<adam12>
Bish: I'm using Iodine which doesn't support http/2 afaik but does support websockets.
jhill has quit [Write error: Connection reset by peer]
ctp has quit [Ping timeout: 252 seconds]
englishm has quit [Ping timeout: 252 seconds]
afisher has quit [Ping timeout: 258 seconds]
strmpnk has quit [Read error: Connection reset by peer]
<adam12>
Bish: Your options are Websockets, long-polling, SSE. You migt be able to use http2 since it's a streaming protocol. I'd say long-polling is the simplest at smaller scales. The message_bus gem works well for that (I use it paired with Roda).
ctp has joined #ruby
afisher has joined #ruby
jhill has joined #ruby
dsmythe has quit [Ping timeout: 252 seconds]
englishm has joined #ruby
strmpnk has joined #ruby
ec has joined #ruby
<lupine>
SSE is *really* simple for unidirectional stuff
<uplime>
Swyper: you'd need to show the rspec file
<rindolf>
Swyper: you are not calling random_word
<Swyper>
oo
<phaul>
rindolf: by collision you mean to get a dir name that's already there?
<rindolf>
phaul: yes
<rindolf>
phaul: if the time is the same
<phaul>
but tmpdir is unique
<phaul>
&>> Dir.tmpdir
<rubydoc>
# => undefined method `tmpdir' for Dir:Class (NoMethodError) stderr: -e:2:in `<main>': undefined method... check link for more (https://carc.in/#/r/6sjg)
<phaul>
one could spam //tmp with links to /etc/. then when root runs this they just corrupt /etc. it's far fetched, but shows the problem
jenrzzz has joined #ruby
gigetoo has quit [Ping timeout: 245 seconds]
<phaul>
that's why tmp names should not be predictable
yokel has quit [Ping timeout: 246 seconds]
gigetoo has joined #ruby
yokel has joined #ruby
sgen has joined #ruby
<rindolf>
phaul: should it be Dir::mktmpdir() or Dir.mktmpdir()?
<phaul>
Dir.mktmpdir
<rindolf>
phaul: ok
<phaul>
:: should only be used in constant nesting
<phaul>
like A::B::C ...
jelera has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jelera has joined #ruby
jelera has quit [Client Quit]
jelera has joined #ruby
jelera has quit [Client Quit]
jelera has joined #ruby
jelera has quit [Client Quit]
nowhere_man has joined #ruby
jrafanie has joined #ruby
jelera has joined #ruby
<ramfjord>
Swyper: was that for a class or something? Personally I don't recommend writing tests that verify private state within a class - test the public interface only
jelera has quit [Client Quit]
<ramfjord>
the "specification"
<Swyper>
yeah its for an online course
nadir has joined #ruby
jelera has joined #ruby
jelera has quit [Client Quit]
<rindolf>
phaul: thanks
<phaul>
Swyper: I guess the specs came with the assignment. Can you share them? It's hard to tell why you are failing them, if can't see them.
<phaul>
I personally would remove () on method calls with no arguments
Steve_ has joined #ruby
<phaul>
but is that code leaving stuff in /tmp after it has run? No program should do that. Disk space is finite.. (but it's the same prior to your patch)
cthu| has joined #ruby
cthulchu_ has quit [Ping timeout: 244 seconds]
<rindolf>
phaul: i see
<rindolf>
phaul: thanks
<phaul>
np
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
Guest29930 has quit [Ping timeout: 246 seconds]
dar123 has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
lubekpl has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy1 has joined #ruby
lubekpl has quit [Quit: WeeChat 1.9.1]
nowhere_man has quit [Ping timeout: 246 seconds]
lubekpl has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
doodleb89 has quit [Read error: Connection reset by peer]
doodlebug has joined #ruby
brandoncc has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
kyrylo has joined #ruby
Swyper has quit [Remote host closed the connection]
doodleb12 has joined #ruby
jenrzzz has joined #ruby
krawchyk has quit [Quit: krawchyk]
Steve_ has quit [Ping timeout: 256 seconds]
doodlebug has quit [Ping timeout: 268 seconds]
nowhere_man has joined #ruby
hightower2 has joined #ruby
weteamsteve has quit [Ping timeout: 276 seconds]
doodleb12 has quit [Read error: Connection reset by peer]
r29v has joined #ruby
r29v has quit [Client Quit]
jenrzzz has quit [Ping timeout: 255 seconds]
code_zombie has joined #ruby
doodlebug has joined #ruby
ErhardtMundt has quit [Read error: Connection reset by peer]
<Swyper>
ere are the spec tests failing as well phaul
<Swyper>
and updated code
queip has quit [Ping timeout: 258 seconds]
nowhere_man has quit [Ping timeout: 258 seconds]
nowhere_man has joined #ruby
queip has joined #ruby
cthu| has quit [Ping timeout: 246 seconds]
jefffrails35 has quit [Read error: Connection reset by peer]
<phaul>
Swyper: I ranyour code locally, let'slook at the first issue.
<phaul>
It complains "undefined method `length' for nil:NilClass" on line that contains @guess_word = Array.new(@guess_word.length, "-")
<phaul>
can you confirm you are seeing the same?
gb_away has quit [Ping timeout: 246 seconds]
<phaul>
an instance variable (variable with @) is nil on first encounter. That means @guess_word.length is sending the length message to nil object. That's why it's failing
<Swyper>
Hi phaul I am not seeing the same, I think that is because I am just running the command to run the tests (bundle exec rspec)
<phaul>
we have to somehow find a way so that you see proper error messages reported
<phaul>
what I did was the following: copied your source in a file, added require 'rspec/autorun' to the top, and removed (commented out the lines which weren't code
<phaul>
then I ran it with $ ruby blah.rb ### blah.rb is the file...
<Swyper>
require 'rspec/autorun' will just automatically run rspec I guess?
<phaul>
it passed 4 tests, failed the rest and also gave error messages for each failure
<phaul>
yes
<Swyper>
neat I will do that
doodlebug has quit [Read error: Connection reset by peer]
gb_away has joined #ruby
<Swyper>
Rtyer$ ruby lib/hangman.rb
<Swyper>
No examples found.
<Swyper>
Finished in 0.00043 seconds (files took 0.09187 seconds to load)
<havenwood>
Swyper: It's common inside a class to use `self` to refer to the instance or `self.class` to refer to the class. That way, if you rename `Hangman` you only have to change it in one place.
<havenwood>
self.class.random_word
<havenwood>
Swyper: You have to define @guess_word before you can check its #length
<havenwood>
Swyper: That first use of Array.new on line 6 is great, since it's properly using arguments. The second Array.new without arguments should instead be an Array literal: []
<havenwood>
Swyper: @attempted_chars = []
Swyper has quit [Ping timeout: 246 seconds]
<havenwood>
Swyper: Remove parens from the end of methods without arguments. So `def secret_word` not `def secret_word()`.
<havenwood>
There's a helper called `attr_reader` that can replace the methods on lines 10-25 that simply expose an instance variable of the same name.
<havenwood>
`attr_reader :secret_word` is the same as `def secret_word; @secret_word; end`
<phaul>
they are gone... Online courses depending on your background can be extremly hard I think.
<phaul>
there is no direct feedback, you have to figure out on your own..
<havenwood>
phaul: yeah, they go from new to Ruby to create your own class with a ton missing inbetween
Swyper has joined #ruby
<phaul>
yeah. tbh, I want to encourage ppl and help them when they around, but when a bootcamp or such frees them from a couple of grand and promises that they will learn web and rails in 2 month.. oh well..
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doodleb35 has quit [Read error: Connection reset by peer]
Dbugger has quit [Ping timeout: 264 seconds]
doodlebug has joined #ruby
Swyper has quit [Remote host closed the connection]