elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kindwindfall__ has quit [Ping timeout: 260 seconds]
chouhoulis has quit [Remote host closed the connection]
shoshin has quit [Quit: Ping timeout (120 seconds)]
shoshin has joined #ruby
hiroaki_ has joined #ruby
hiroaki has quit [Ping timeout: 258 seconds]
Rudd0 has quit [Ping timeout: 256 seconds]
powerhouse has quit [Read error: Connection reset by peer]
powerhouse has joined #ruby
akem has quit [Ping timeout: 272 seconds]
titanbiscuit has quit [Ping timeout: 265 seconds]
BSaboia has joined #ruby
adu has quit [Quit: adu]
cd has quit [Quit: cd]
BSaboia has quit [Quit: This computer has gone to sleep]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BSaboia has joined #ruby
`Alison has quit [Ping timeout: 240 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
BSaboia has joined #ruby
Glumetu has joined #ruby
BSaboia has quit [Client Quit]
cnsvc has quit [Ping timeout: 240 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
`Alison has joined #ruby
imode has quit [Ping timeout: 246 seconds]
imode has joined #ruby
TvL2386 has joined #ruby
_whitelogger has joined #ruby
teclator has quit [Ping timeout: 264 seconds]
BTRE has quit [Ping timeout: 258 seconds]
BTRE has joined #ruby
dionysus69 has joined #ruby
Ediz has joined #ruby
<Ediz>
Hello to all, hope you're having a good day
universa1 has quit [Ping timeout: 272 seconds]
nyuszika7h_ has joined #ruby
Kilo`byte has joined #ruby
imode has quit [Ping timeout: 265 seconds]
universa1 has joined #ruby
jhass|off has joined #ruby
marahin has quit [Ping timeout: 272 seconds]
RushPL has quit [Ping timeout: 272 seconds]
nyuszika7h has quit [Ping timeout: 272 seconds]
jhass has quit [Ping timeout: 272 seconds]
jhass|off is now known as jhass
Kilobyte22 has quit [Ping timeout: 260 seconds]
<Ediz>
I've a question and its about testing and mocking - I've a class that uses SecureRandom.base64 in its constructor to test a connection - because the secure random is used directly in the constructor I can't mock what its returning in my tests. If I passed SecureRandom as a dependency, I would be able to do it but it feels weird to do that. Any ideas? suggestions? Thanks in advance.
<Ediz>
because I can't know the test_hash that is generated by SecureRandom I can't mock redis so that it returns this same hash for the logic I'm testing
<Ediz>
only way I see is to pass SecureRandom to the class from outside and mock that too
<Ediz>
which feels weird to do
DarthGandalf has joined #ruby
rippa has joined #ruby
burgestrand has joined #ruby
Technodrome has joined #ruby
<isene>
Use Case = Autocompletion for files and dirs: In curses, user enters part of a path and hits TAB, code autocompletes like usual in a shell. Caveat: I cannot use any external module for this (like Readline) since the curses module cannot interface with such. Hence, I must create this autocompletion from scratch - matching parts of paths using Dir, File or any other built-in Ruby module. Any tips?
vondruch_ has joined #ruby
<phaul>
Ediz: I think you wanted && in the condition but prly doesn't matter that much result == 'OK' || @redis.get('test') == test_hash
<phaul>
just makes more sense with &&
vondruch_ has quit [Quit: vondruch_]
<Ediz>
phaul the code works, I want to know how to test that bit of code in the constructor
<isene>
OK, I found a way using Dir.glob
TCZ has joined #ruby
rapha has left #ruby ["WeeChat 2.3"]
<phaul>
Ediz: sure, I wasn't saying it wasn't working just that the condition is probably wrong. If only one of your conditions fail you still want to report the error I assume. If result is 'OK' and the other condition is false this is true, in which case no exception raised, which is weird. To answer your question: a common trick in dependency injection is to take the dependency as a default argument :
<phaul>
initialize(redis, random = SecureRandom). An other way is to allow(SecureRandom).to receive(:base64) etc. also works
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has joined #ruby
<Ediz>
thank you
dviola has quit [Quit: WeeChat 2.9]
<Glumetu>
hello can ask a noob question? i have some variables like c1 c2 ... c100 how can i do a loop and assign new values to them?
<Glumetu>
i do not kwow the sintax on how to append a number to a leter some thing like while $i < $num do c[$i] = a*b $i +=1 end
<leftylink>
you are correct that using an array would be better. if it must not be an array for unadvisable reasons out of the coder's control, then the search term to use on one's preferred search engine might be "ruby dynamic variable name"
<leftylink>
as will be seen on those search results, they will still recommend using an array
ruurd has joined #ruby
impermanence has joined #ruby
burgestrand has quit [Quit: burgestrand]
burgestrand has joined #ruby
lucasb has joined #ruby
TCZ has quit [Quit: Leaving]
bmurt has joined #ruby
ta has quit [Quit: WeeChat 2.9]
adu has joined #ruby
BSaboia has joined #ruby
ta has joined #ruby
impermanence has quit [Ping timeout: 256 seconds]
SeepingN has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
<adam12>
Ediz: A couple thoughts; I wouldn't do all that work in the constructor. I'd make a new constructor and then call a method on the new instance that does the work.
<Ediz>
thx adam12, care to elaborate a little bit?
<adam12>
Ediz: I'd pass in the random method. Rely on the fact that a lot of things can respond to call, which means as a default you could do `random = SecureRandom.method(:base64); random.call(value)` and then for testing, pass a lambda or proc. `new(->(_) { "i'm random" })`
cliluw has quit [Ping timeout: 265 seconds]
cliluw has joined #ruby
<Ediz>
okay, thanks again
<Tuor>
Hi, how is it called that an array is expanded into arguments?: `arg=['echo', '*']; system(*arg)`
<adam12>
Ediz: This gives you 3 construction methods: normal `new` which doesn't talk to anything outside of itself, `build` which accepts a redis connection and gives you a working random number generator and validates the connection, and `example` which gives you a fake random number generator and still expects something that quacks like Redis.
burgestrand has quit [Quit: burgestrand]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Ediz>
ohh interesting, checking all out. tyvm
<adam12>
Ediz: I just noticed it's called RedisLogRepository, so my comment about another class is probably invalid. But I'd maybe not suffix everything with `logs`.
<Tuor>
adam12: yes. thx.
<adam12>
Ediz: Ie. maybe trim_logs is trim_by_ip, and get_logs is by_ip. log is fine but maybe it should be record?
<adam12>
Ediz: In the weeds now but just an observation.
<Ediz>
yes definately appreciate the feedback
SeepingN has joined #ruby
<Ediz>
and you're right
<Ediz>
so hard naming things :)
<adam12>
Yeah it 100% is
burgestrand has joined #ruby
TCZ has quit [Quit: Leaving]
Glumetu has quit [Quit: Glumetu]
burgestrand has quit [Quit: burgestrand]
cthu| has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
akem has joined #ruby
elcontrastador has joined #ruby
entel has quit []
entel has joined #ruby
impermanence has joined #ruby
teardown has quit [Ping timeout: 240 seconds]
impermanence has quit [Quit: Connection closed]
impermanence has joined #ruby
orbyt_ has joined #ruby
Rudd0 has quit [Ping timeout: 258 seconds]
Azure has quit [Read error: Connection reset by peer]
howdoi has joined #ruby
elxbarbosa has joined #ruby
<elxbarbosa>
join /rails
<apotheon>
no thanks
bamdad has quit [Ping timeout: 240 seconds]
<adam12>
ಠ_ಠ
dviola has joined #ruby
imode has joined #ruby
entel has quit []
entel has joined #ruby
entel has quit [Client Quit]
entel has joined #ruby
bamdad has joined #ruby
bamdad has quit [Ping timeout: 240 seconds]
ellcs has joined #ruby
fandre1986 has joined #ruby
BSaboia has joined #ruby
powerhouse has quit [Quit: Leaving]
impermanence has quit [Ping timeout: 246 seconds]
powerhouse has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
Sina has quit [Quit: Connection closed for inactivity]
cthulchu_ has joined #ruby
cthulchu_ has quit [Max SendQ exceeded]
cthulchu_ has joined #ruby
powerhouse has quit [Remote host closed the connection]
cthulchu_ has quit [Max SendQ exceeded]
BSaboia has joined #ruby
cthulchu_ has joined #ruby
cthu| has quit [Ping timeout: 256 seconds]
powerhouse has joined #ruby
BSaboia has quit [Client Quit]
dhollinger has quit [Ping timeout: 264 seconds]
dhollinger has joined #ruby
fippy has quit [Ping timeout: 256 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
BSaboia has joined #ruby
BSaboia has quit [Client Quit]
BSaboia has joined #ruby
cnsvc has joined #ruby
BSaboia has quit [Client Quit]
fippy_ has joined #ruby
BSaboia has joined #ruby
BSaboia has quit [Client Quit]
fippy_ is now known as fippy
BSaboia has joined #ruby
fandre1986 has quit [Ping timeout: 260 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TCZ has joined #ruby
burgestrand has joined #ruby
ruurd has quit [Read error: Connection reset by peer]
<apotheon>
I'll see if I have time to read that in the near future.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<isene>
apotheon: That's my prefered license
ur5us has joined #ruby
<fippy>
isene: firefox says that rtfm-screencast.mp4 is corrupt
elxbarbosa has quit [Ping timeout: 272 seconds]
<isene>
Firefox is wrong.
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
"ecoder may not have the capability to handle the requested video format with YUV444 chroma subsampling."
<apotheon>
The screencast seems to play fine in Vimb.
<apotheon>
The video and audio seem very out-of-sync for me, though.
<adam12>
isene: Watched the video. Neat project.
<apotheon>
Just giving the filename to mpv plays with no sync issue, though, so that's nice.
<isene>
adam12: Thanks
<apotheon>
isene: I think this is the first time I've seen a file manager (other than just the shell itself) that looks potentially interesting for me to use.
<apotheon>
I might have to give that a try, now.
<isene>
apotheon: 😊
pwnd_sfw has joined #ruby
bamdad has joined #ruby
imode has quit [Ping timeout: 240 seconds]
rowendy has joined #ruby
rowendy has left #ruby [#ruby]
rowendy has joined #ruby
<apotheon>
isene: How configurable is it? Is there a way to change keybindings?
rowendy_ has joined #ruby
rowendy has left #ruby [#ruby]
<isene>
apotheon: Nope. Not yet.
<apotheon>
ahh
<isene>
But the bindings are perfect as they are
<apotheon>
My interest wanes for the moment, but it's worth mentioning to other people who like the idea of console-based file managers.
<apotheon>
They aren't perfect for me. I don't like moving my hands away from home row, so I was hoping for a way to turn things like arrow keys into vi-like keybindings.
adu has quit [Quit: adu]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
<isene>
I could easily add the standard motion keys from VIM. That's like 3 mins including a remapping of h and documentation