jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
tgragnato has quit [Quit: Sto andando via]
JeanCarl1Machado has quit [Ping timeout: 268 seconds]
JeanCarl1Machado has joined #ruby
JeanCarloMachado has quit [Ping timeout: 246 seconds]
hndk has joined #ruby
itarato has joined #ruby
JeanCarloMachado has joined #ruby
raul782 has joined #ruby
JeanCarl1Machado has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
JeanCarl1Machado has joined #ruby
raul782 has quit [Client Quit]
jenrzzz has joined #ruby
apparition has quit [Quit: Bye]
JeanCarloMachado has quit [Ping timeout: 240 seconds]
mim1k has joined #ruby
JeanCarloMachado has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
Tempesta has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
JeanCarl1Machado has quit [Ping timeout: 240 seconds]
JeanCarloMachado has quit [Ping timeout: 268 seconds]
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
brent__ has joined #ruby
claw has quit [Ping timeout: 245 seconds]
apparition has joined #ruby
itarato has quit [Ping timeout: 268 seconds]
nickjj_ has joined #ruby
brent__ has quit [Ping timeout: 268 seconds]
KeyJoo has quit [Remote host closed the connection]
nickjj has quit [Ping timeout: 255 seconds]
perniciouscaffei has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ahrs has quit [Remote host closed the connection]
ahrs has joined #ruby
perniciouscaffei has joined #ruby
gix has quit [Ping timeout: 240 seconds]
claw has joined #ruby
gix has joined #ruby
hndk has quit [Quit: Leaving]
gothicsouth has joined #ruby
nankyokusei has joined #ruby
newbz has joined #ruby
newbz has quit [Client Quit]
jenrzzz has joined #ruby
raul782 has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
newbs has quit [Ping timeout: 272 seconds]
perniciouscaffei has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bipul has joined #ruby
cfec0b8d has quit [Remote host closed the connection]
astrobunny has joined #ruby
astrobunny has quit [Remote host closed the connection]
perniciouscaffei has joined #ruby
apparition has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bruno- has quit [Ping timeout: 260 seconds]
hahuang65 has joined #ruby
dviola has quit [Quit: WeeChat 1.8]
hahuang65 has quit [Ping timeout: 240 seconds]
mim1k has joined #ruby
brent__ has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
auzty has joined #ruby
renchan has joined #ruby
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
cyphase has quit [Ping timeout: 240 seconds]
cyphase has joined #ruby
perniciouscaffei has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
paradisaeidae has joined #ruby
paradisaeidae_ has joined #ruby
cfec0b8d has joined #ruby
apparition has joined #ruby
brent__ has quit [Remote host closed the connection]
apparition has quit [Ping timeout: 246 seconds]
Seenox has quit [Ping timeout: 260 seconds]
AnoHito_ has joined #ruby
JoshS has quit [Read error: Connection reset by peer]
JoshS has joined #ruby
AnoHito has quit [Ping timeout: 240 seconds]
borodin has quit [Ping timeout: 246 seconds]
AnoHito has joined #ruby
apparition has joined #ruby
tildes has joined #ruby
igniting has quit [Ping timeout: 240 seconds]
AnoHito_ has quit [Ping timeout: 260 seconds]
__Yiota has joined #ruby
__Yiota has quit [Client Quit]
cschneid_ has joined #ruby
cschneid_ has quit [Remote host closed the connection]
cschneid_ has joined #ruby
redaudit has quit [Quit: Cya]
quobo has quit [Quit: Connection closed for inactivity]
rkazak has quit [Quit: Sleep.....ing....]
hahuang65 has joined #ruby
anisha has joined #ruby
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid_ has quit [Ping timeout: 240 seconds]
TechMonger has quit [Ping timeout: 240 seconds]
ur5us has quit [Remote host closed the connection]
xall has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
tildes has quit [Ping timeout: 268 seconds]
oleo has quit [Quit: irc client terminated!]
Cohedrin has joined #ruby
tildes has joined #ruby
grymmjack has quit [Remote host closed the connection]
igniting has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
timredd has joined #ruby
timredd has quit [Client Quit]
dionysus69 has joined #ruby
Bock has joined #ruby
Bock has quit [Max SendQ exceeded]
Bock has joined #ruby
al2o3-cr has quit [Quit: WeeChat 1.7.1]
nankyokusei has joined #ruby
DeeJayh has joined #ruby
bigkevmcd has quit [Ping timeout: 240 seconds]
<DeeJayh>
What's the best way to do multiple things in ruby at the same time. Example, I have a class named game. Then I have classes that inherit that with specific names like bingo and roullette. Now I want to run both together. As in, I don't want to do bingo and then roulette, I want them to run side by side at the same time so those enjoying one don't have to wait on the other to finish.
p0p0pr37_ has joined #ruby
p0p0pr37_ has joined #ruby
p0p0pr37_ has quit [Changing host]
tildes has quit [Ping timeout: 260 seconds]
PaulCape_ has joined #ruby
<foxmask>
bonjello
nankyokusei has quit [Ping timeout: 255 seconds]
<DeeJayh>
?
bigkevmcd has joined #ruby
PaulCapestany has quit [Ping timeout: 255 seconds]
p0p0pr37 has quit [Ping timeout: 272 seconds]
p0p0pr37_ is now known as p0p0pr37
aufi has joined #ruby
al2o3-cr has joined #ruby
Mortomes|Work has joined #ruby
<eam>
DeeJayh: you can use a thread
<DeeJayh>
Specifically, for clients connecting to a server. This server will accept connections, but also run the games and send the results to the currently connected clients
<DeeJayh>
if I try to setup the client connections, even in a thread, it sits and waits for a client to connect before running the rest of the program
<DeeJayh>
I guess I could just set up the calls to the classes to make the games start running in threads first, and then wait for connections from clients... would make sense
<DeeJayh>
just thought maybe there would be a better way to do this
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<eam>
there are frameworks for this sort of thing
<eam>
you can also use separate processes per-connection
raspado has joined #ruby
bambanx has joined #ruby
djbkd_ has joined #ruby
blackwind_123 has quit [Quit: ASCII a stupid question, get a stupid ANSI!]
raspado has quit [Ping timeout: 240 seconds]
Seenox has joined #ruby
Burgestrand has joined #ruby
conta has joined #ruby
ta_ has quit [Remote host closed the connection]
vuoto has joined #ruby
Hunter1 has quit [Remote host closed the connection]
conta has quit [Remote host closed the connection]
<Burgestrand>
Seenox when you do "#{body}", Ruby will do (kind of): "" + body.to_s + "", which takes whatever is inside body and turns it into a string representation
<Seenox>
Burgestrand: It worked! Thanks for the explanation.
<Burgestrand>
Seenox doing JSON.dump("some string representation of body") is not really what you want :)
blackmesa has joined #ruby
<Seenox>
Now I know why it used to convert my hash to string...
<Burgestrand>
Yup :)
bipul has quit [Ping timeout: 240 seconds]
<Seenox>
Burgestrand: Thank you. One more quick question regarding this: Is it also the same for other functions? For example: puts #{body} vs. puts body?
jenrzzz has quit [Ping timeout: 268 seconds]
bambanx has quit [Quit: Leaving]
<Burgestrand>
Seenox so the case with "something #{body} something else}", Ruby will always convert `body` in there to a string using the method #to_s on body
<Burgestrand>
Seenox in the case with a string, doing "some string".to_s just returns the same string, since it's always a string
<Burgestrand>
Seenox and I think (not sure) the case with puts, is that it'll call #to_s whatever you give it
<Seenox>
Burgestrand: No matter if it's a hash or array or object or anything else?
<Burgestrand>
Seenox yep
<Burgestrand>
Seenox if you want to see some more structure, I recommend using `p` instead of `print`, it'll call #inspect instead of #to_s, and #inspect typically gives more debug-friendly output
<ljarvis>
DaniG2k: pretty sure that's not how cancancan works. You don't specify particular controllers or actions. You just say `can :manage, :listings` and then whenever you want to check, you just do `user.can?(:manage, :listings)` in your controller/views
<ljarvis>
or maybe add to `authorize_resource`
<ljarvis>
ah right maybe it doesn't work like that anymore.. hmm
<ljarvis>
cancancan is weird
tvw has joined #ruby
<DaniG2k>
it is :/
<DaniG2k>
wish I could use Pundit instead hehe
<ljarvis>
why can't you?
ur5us has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
user128_ has quit [Quit: Leaving]
jaruga has joined #ruby
lipoqil has joined #ruby
<DaniG2k>
cause this project is already using Cancancan. Working on it with a team of fools
<DaniG2k>
help haha
marr has joined #ruby
<DaniG2k>
nah it's ok
<DaniG2k>
will figure it out
blackmesa has quit [Ping timeout: 240 seconds]
enterprisey has quit [Read error: Connection reset by peer]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Beams has joined #ruby
DaniG2k has quit [Quit: leaving]
rgr has quit [Ping timeout: 240 seconds]
tomphp has joined #ruby
MrBusiness3 has joined #ruby
TreyG has joined #ruby
MrBismuth has quit [Ping timeout: 246 seconds]
xall has quit [Ping timeout: 260 seconds]
mim1k has joined #ruby
Surver has joined #ruby
<Surver>
Hi
xall has joined #ruby
User458764 has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
mim1k has joined #ruby
xall has quit [Ping timeout: 240 seconds]
pandaant has joined #ruby
otherj has quit [Quit: .]
rgr has joined #ruby
Surver has quit [Quit: Leaving...]
xall has joined #ruby
leitz has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
sonic_m has joined #ruby
rgr has quit [Remote host closed the connection]
rgr has joined #ruby
romank has joined #ruby
sonicmagister has quit [Ping timeout: 260 seconds]
rgr has quit [Remote host closed the connection]
rgr has joined #ruby
CrazyEddy has quit [Remote host closed the connection]
sonicmagister has joined #ruby
rgr has quit [Remote host closed the connection]
rgr has joined #ruby
sonic_m has quit [Ping timeout: 246 seconds]
rgr has quit [Remote host closed the connection]
rgr has joined #ruby
sonic_m has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
sonicmagister has quit [Ping timeout: 260 seconds]
aupadhye has joined #ruby
sonicmagister has joined #ruby
Kug3lis has joined #ruby
sonic_m has quit [Ping timeout: 240 seconds]
CrazyEddy has joined #ruby
biberu has joined #ruby
<zenspider>
rawr
rgr has quit [Remote host closed the connection]
rgr has joined #ruby
<ljarvis>
go to bed it's late
<zenspider>
selim: that "here is why" part seems important
<ljarvis>
DeeJayh: what's happening vs what you expect? I would expect that problem to exit almost immediately due to the main thread exiting
<ljarvis>
program*
rgr has joined #ruby
<DeeJayh>
ok so add a loop{} on the end of it
<DeeJayh>
actually forget the loop
<DeeJayh>
you're right
workmad3 has joined #ruby
<DeeJayh>
I'd expect it to end
<DeeJayh>
but it doesnt
<DeeJayh>
it just keeps looping inside roulette
<ljarvis>
the program that you pasted in its entirety does not end?
xall has quit [Ping timeout: 240 seconds]
<ljarvis>
also, your program should cause a stack level error
<DeeJayh>
no
<ljarvis>
you can't do what you're doing
<DeeJayh>
I've updated it as shown in the gist
jenrzzz has joined #ruby
<DeeJayh>
if you refresh the page
<DeeJayh>
and it just does betting1roll1betting1roll1 infinitely
<ljarvis>
it exits immediately because there's nothing blocking the main thread. What Ruby version and OS are you on?
<DeeJayh>
that's the problem the rest of the main thread is never called! it gets stuck on roulette infinitely, Thread.new { crash.betting } never gets called, the main thread never exits
<DeeJayh>
version is irrelevent, I tried ruby 2.3.3, jruby (mine uses 2.3.1) both on windows
<ljarvis>
right, hence me asking what Ruby version and OS you're on, because that's not the behaviour I would expect
<DeeJayh>
see, what you're saying it should do, is what I EXPECT it to do
<DeeJayh>
I should probably also open an issue there then while I'm at it
<DeeJayh>
About the bug
psychicist__ has joined #ruby
<ljarvis>
yes I think that'd be helpful to the jruby folks
mim1k has joined #ruby
Mortomes|Work has joined #ruby
ur5us has quit [Remote host closed the connection]
rgr has quit [Remote host closed the connection]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<DeeJayh>
yup I just compared it against the stdlib/securerandom copy included in my current version of ruby and I see exactly what is missing. I'll fork it, fix it, and submit a pull request
rgr has joined #ruby
awille has joined #ruby
User458764 has joined #ruby
dasher00 has quit [Quit: Leaving]
nankyokusei has joined #ruby
sonicmagister has quit [Read error: Connection reset by peer]
sonicmagister has joined #ruby
rgr has quit [Ping timeout: 240 seconds]
mim1k has quit [Ping timeout: 268 seconds]
sonicmagister has quit [Read error: Connection reset by peer]
nankyokusei has quit [Ping timeout: 240 seconds]
sonicmagister has joined #ruby
Hunter1 has quit [Remote host closed the connection]
Hunter1 has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
mim1k has joined #ruby
apparition has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pifon has quit [Quit: Connection closed for inactivity]
nobitanobi has joined #ruby
raspado has joined #ruby
xall has joined #ruby
raspado has quit [Ping timeout: 246 seconds]
zapata has quit [Quit: WeeChat 1.8]
Burgestrand has quit [Quit: Closing time!]
leitz has quit [Quit: Nappy time]
Burgestrand has joined #ruby
zapata has joined #ruby
jaruga has quit [Quit: jaruga]
itarato has joined #ruby
Hunter1 has quit [Remote host closed the connection]
Hunter1 has joined #ruby
psychicist__ has quit [Quit: Lost terminal]
itarato has quit [Ping timeout: 260 seconds]
sleetdrop has joined #ruby
Burgestrand has quit [Quit: Closing time!]
jameser has quit [Ping timeout: 255 seconds]
Burgestrand has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
DeeJayh has quit [Ping timeout: 246 seconds]
sonicmagister has quit [Read error: Connection reset by peer]
itarato has joined #ruby
auzty has quit [Ping timeout: 240 seconds]
mim1k has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
mim1k has joined #ruby
Burgestrand has quit [Quit: Closing time!]
pankaj_ has joined #ruby
Burgestrand has joined #ruby
genpaku has quit [Ping timeout: 240 seconds]
genpaku has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
rikkipitt has quit [Quit: Leaving...]
mim1k has quit [Ping timeout: 268 seconds]
antgel has joined #ruby
Hunter1 has quit [Remote host closed the connection]
auzty has joined #ruby
Hunter1 has joined #ruby
cfec0b8d has joined #ruby
Burgestrand has quit [Quit: Closing time!]
Burgestrand has joined #ruby
DoubleMalt has joined #ruby
nobitanobi has quit [Remote host closed the connection]
nobitanobi has joined #ruby
nobitanobi has quit [Remote host closed the connection]
lipoqil has quit [Quit: Connection closed for inactivity]
<cahoots>
hi, so i want to refer to relative paths in my ruby script easily, and to do so i was doing Dir.chdir(__dir__). but then i have to have one at the start of my require statements and at the end of them, so that i can do relative requires that might change the cwd. is there a better way of doing this?
<dminuoso>
cahoots: You usually use the File helper methods to construct paths together with __FILE__
<dminuoso>
i.e. File.dirname(__FILE__) is something you see an awful lot in Ruby programs
<dminuoso>
It's an established pattern I guess.
<dminuoso>
That avoids messing with the pwd entirely.
<dminuoso>
*cwd
shadeslayer_ is now known as shadeslayer
<cahoots>
dminuoso, hmm, i like mine more i guess
<cahoots>
it seems cleaner in the long run
<dminuoso>
cahoots: Except File.dirname(__FILE__) gives you precise semantics. chdir has some nasty side-effects
<dminuoso>
cahoots: Imagine your application crashes at some point.
<elomatreb>
IIRC chdir has a block form that automatically changes back, if you're OK with wrapping your whole program in a block
<elomatreb>
But yeah, I agree with dminuoso
raul782 has joined #ruby
<dminuoso>
cahoots: And as I mentioned, it's an established pattern in the Ruby community. :)
<cahoots>
i don't understand what the side effecs are, certainly my shell doesn't get its pwd changed
<cahoots>
and wouldn't __dir__ be more concise?
ahrs has quit [Remote host closed the connection]
kyeeh has joined #ruby
<dminuoso>
cahoots: __dir__ is a method, __FILE__ is a constant.
ahrs has joined #ruby
blackmesa has quit [Ping timeout: 272 seconds]
<cahoots>
i don't see the significance
<dminuoso>
cahoots: Mmm, But actually you are right __dir__ is actually more elegant.
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
Guess old habits die hard.
chouhoul_ has joined #ruby
<dminuoso>
File.expand_path(__dir__, '../foo') is the way to go
chouhoul_ has quit [Remote host closed the connection]
<cahoots>
it seems like properness is correlated with verboseness
chouhoul_ has joined #ruby
Lucky_ABA has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<dminuoso>
cahoots: Writing code is not about trying to save as much characters as possible. chdir gives you state machine semantics.
<dminuoso>
Which is that much more difficult to reason about.
<dminuoso>
cahoots: Let's say you call some code. Do you know whether that code did a ninja change to the cwd?
itarato has quit [Ping timeout: 246 seconds]
<cahoots>
it doesn't matter if my project adopts a consistent structure
<dminuoso>
cahoots: Can you say the same about any library you use.
<dminuoso>
?
<cahoots>
dminuoso, i don't think any third-party libs care which directory is current. even if i didn't change dir from within the script, it's inherited from the shell
chouhoulis has quit [Ping timeout: 240 seconds]
Kug3lis has joined #ruby
<dminuoso>
The problem about relying on mutable globals (and cwd for all intends is a global) is that you have to prove that *all* code respects proper semantics
<dminuoso>
It's much more difficult to just using File.expand_path(__dir__, 'foo')
<dminuoso>
Because any code can mutate it.
cfec0b8d has joined #ruby
<dminuoso>
Mutable globals are bad. Always.
<dminuoso>
They stink of poor code design.
<dminuoso>
They are also downright impossible to test.
<cahoots>
the great thing about ruby is you can do it lots of ways, so i'll stick with mine
rippa has joined #ruby
zapata has quit [Ping timeout: 272 seconds]
<dminuoso>
That does not mean that most ways are sensible.
<dminuoso>
But luckily I dont car.e
itarato has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<elomatreb>
Did you see that block form of chdir I mentioned? Might at least help with the cleaning up part
__Yiota has joined #ruby
cfec0b8d has quit [Remote host closed the connection]
raul782 has quit [Remote host closed the connection]
raspado has joined #ruby
<cahoots>
yeah i'll check it out
<cahoots>
thanks for the advice dminuoso elomatreb
raul782 has joined #ruby
dellavg has left #ruby ["Ex-Chat"]
cdg has joined #ruby
Silthias1 has joined #ruby
Beams has quit [Quit: .]
cschneid_ has joined #ruby
LuckyABA has joined #ruby
Silthias has quit [Ping timeout: 272 seconds]
Beams has joined #ruby
BSab has quit [Ping timeout: 246 seconds]
TomyWork has quit [Ping timeout: 240 seconds]
zapata has joined #ruby
etehtsea has joined #ruby
bkxd has joined #ruby
xall has quit [Ping timeout: 240 seconds]
gothicsouth has joined #ruby
xychix has quit [Ping timeout: 240 seconds]
pankaj_ has quit [Ping timeout: 268 seconds]
bmgoog has joined #ruby
kyeeh has quit []
haylon has quit [Ping timeout: 246 seconds]
itarato has quit [Ping timeout: 260 seconds]
bruno- has quit [Ping timeout: 240 seconds]
mikecmpb_ has quit [Quit: inabit. zz.]
bkxd has quit [Ping timeout: 260 seconds]
jespada has joined #ruby
mikecmpbll has joined #ruby
mrgrieves has joined #ruby
hobodave has joined #ruby
itarato has joined #ruby
pankaj_ has joined #ruby
<mrgrieves>
hi, how can I export bash env vars from a .rb script i.e. I want the script to do the same as doing export in the shell
mim1k has joined #ruby
<mrgrieves>
?
cam27 has joined #ruby
mattp__ has quit [Remote host closed the connection]
<matthewd>
mrgrieves: A process can't affect its parent's environment
Beams has quit [Quit: .]
conta has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
Beams has joined #ruby
rkazak has joined #ruby
<mrgrieves>
matthewd: so I guess my best option is to do this from within a bash script?
pratch has quit [Ping timeout: 240 seconds]
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
<matthewd>
A bash script run as a new process can't do it either -- but a bash script can be sourced, which will do what you want
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
<matthewd>
The only other option is to do something like `eval "$(ruby your_script.rb)"`, and have it output the shell commands to set the exports
pankaj_ has quit [Ping timeout: 240 seconds]
brent__ has joined #ruby
xychix has joined #ruby
pandaant has quit [Remote host closed the connection]
mdw has joined #ruby
ascarter has joined #ruby
pankaj_ has joined #ruby
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
ascarter has quit [Client Quit]
haylon has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
mas886 has joined #ruby
<mas886>
I have a problem with hashes, when I do: hash[key]="hello" it grabs the object key instead of it's value. So once I modify the key to use it again on a loop, the first value key also changes. How can I have hash key to use the key value as a key instead of the object as a key?
bruno- has joined #ruby
User458764 has joined #ruby
ascarter has joined #ruby
<elomatreb>
mas886: Could demo what you mean with a small snippet? I'm not really sure I understand
<mas886>
elomatreb: Okay I will do a little example.
<baweaver>
a hash is basically a dictionary of KV pairs
<mas886>
I know
<baweaver>
are you trying to get a wordcount?
xall has joined #ruby
<mas886>
I'm trying to do exactly what the code does. But when I modify the key value, I want the hash key to remain as it was when I introduced it.
<baweaver>
what's the actual task you're trying to accomplish here?
amclain has joined #ruby
<mas886>
Get a key assoc list where the a key have a value.
<mas886>
The key is created that way.
itarato has quit [Ping timeout: 246 seconds]
<baweaver>
but what's the buffer?
haylon has quit [Remote host closed the connection]
<mas886>
baweaver: Sorry if I cannot give you more information. I'm trying to reverse engeneering some code.
<baweaver>
you're not telling me the task, you're telling me how a hash works
ferr has quit [Quit: WeeChat 1.7]
<mas886>
The buffer is those \n things * for a number
DoubleMalt has quit [Ping timeout: 240 seconds]
haylon has joined #ruby
<baweaver>
...
<mas886>
And then I add the things.
<baweaver>
I can see that
<mas886>
So you know the same I do.
<baweaver>
You have a lot of extra code context
<baweaver>
It makes no real sense
<mas886>
Haha I know.
<elomatreb>
The Hash key is the same object, if you modify it you modify the Hash key too. You could clone it to avoid that, but that's messy
<mas886>
Isn't there a way to assign the object value as the key instead of the object itself?
[Butch] has joined #ruby
patarr has joined #ruby
Pumukel has joined #ruby
<elomatreb>
Now we're getting philosophical, what is an object besides its value? :P
awille has quit [Ping timeout: 240 seconds]
andrew9184 has quit [Ping timeout: 240 seconds]
<elomatreb>
To answer your question: Cloning the array by calling #dup will probably achieve what you want, but I urge you to maybe design your code so that you don't rely on arrays as Hash keys
oliv_____ has joined #ruby
<elomatreb>
I.e. `$hash[buf.dup]=chr`
gusrub has joined #ruby
flying has quit []
davidmichaelkarr has joined #ruby
andrew9184 has joined #ruby
hosas has joined #ruby
aufi has quit [Quit: Leaving]
<havenwood>
mas886: Don't assign your own global variables.
<havenwood>
mas886: I'd suggest taking a step back to look at more Rubyish ways to achieve your goal.
<baweaver>
havenwood: not their code it seems
<havenwood>
baweaver: aha
hosas has left #ruby [#ruby]
<baweaver>
more of a wtf is this question
Pumukel has quit []
oliv_____ has quit [Ping timeout: 246 seconds]
<mas886>
Haha, sorry.
<mas886>
Anyways thanks people.
oleo has joined #ruby
Vingador_ has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
skweek has joined #ruby
olivi____ has joined #ruby
Vingador has quit [Ping timeout: 246 seconds]
nitric has joined #ruby
AlexRussia has quit [Ping timeout: 240 seconds]
fuzzyhorns1 has quit [Quit: Leaving.]
<guardian>
hello, does ruby have something builtin that would allow me to tell whether a string corresponds to a language tag as defined by RFC 4646? e.g. en_US, fr_FR ...
bkxd has joined #ruby
tlaxkit has quit [Quit: tlaxkit]
jespada has quit [Quit: WeeChat 1.7]
<elomatreb>
guardian: You can certainly validate the format, but I don't think Ruby ships with a table. Your OS might though
<guardian>
ok a regex it is then :) thanks
kobain has joined #ruby
im0nde has joined #ruby
pankaj_ has quit [Quit: Leaving]
uZiel has quit [Ping timeout: 268 seconds]
bkxd has quit [Ping timeout: 255 seconds]
mark_66 has quit [Remote host closed the connection]
_sfiguser has joined #ruby
patr0clus has joined #ruby
milardovich has quit [Remote host closed the connection]
rakm has joined #ruby
tildes has joined #ruby
milardovich has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jackrandom has joined #ruby
vuoto has joined #ruby
__Yiota has joined #ruby
olivi____ has quit [Remote host closed the connection]
skweek has quit [Ping timeout: 245 seconds]
milardovich has quit [Ping timeout: 272 seconds]
itarato has joined #ruby
oleo has quit [Remote host closed the connection]
alazred has quit [Ping timeout: 258 seconds]
AlexRussia has joined #ruby
jackrandom has quit [Remote host closed the connection]
nankyokusei has joined #ruby
Silthias1 has quit [Read error: Connection reset by peer]
oliv_____ has joined #ruby
jackrandom has joined #ruby
redaudit has quit [Ping timeout: 258 seconds]
jpleau has quit [Read error: Connection reset by peer]
Kug3lis has quit [Ping timeout: 255 seconds]
fuzzyhorns1 has joined #ruby
Asher has quit [Quit: Leaving.]
rgr has joined #ruby
alazred has joined #ruby
alazred has joined #ruby
alazred has quit [Changing host]
rgr has quit [Remote host closed the connection]
minimalism has joined #ruby
oliv_____ has quit [Remote host closed the connection]
fuzzyhorns1 has quit [Client Quit]
etehtsea has joined #ruby
skweek has joined #ruby
Burgestrand has quit [Quit: Closing time!]
jeffreylevesque has joined #ruby
nankyokusei has quit [Remote host closed the connection]
<majuk>
Hello friends. I have an issue. I am trying to use gem/rake to install a new gem. Unfortunately, it's having trouble finding headers [stdio.h, features.h, et al]. I have confirmed gcc/cpp have the proper paths for these libs set up and compiled a quick test program that worked without issue.
<havenwood>
majuk: This is a good place to ask if you have related questions.
<majuk>
So many questions, but none are very constructive. :D
<majuk>
I am pretty far down a rabbit hole at this point. It's dark down here, I don't recommend anyone join me.
tildes has quit [Ping timeout: 268 seconds]
<majuk>
Aaaaand I just filled my SDCard. -.-
milardovich has joined #ruby
anisha_ has quit [Quit: Leaving]
xall has quit [Ping timeout: 240 seconds]
romank has joined #ruby
marlinc has quit [Ping timeout: 246 seconds]
whathappens has quit [Remote host closed the connection]
enterprisey has joined #ruby
whathappens has joined #ruby
oleo has joined #ruby
bambanx has joined #ruby
brent__ has quit [Remote host closed the connection]
armyriad has quit [Ping timeout: 268 seconds]
lxsameer has joined #ruby
xall has joined #ruby
armyriad has joined #ruby
whathappens has quit [Ping timeout: 246 seconds]
jgt has joined #ruby
nobitanobi has joined #ruby
olivi____ has joined #ruby
LukyCZ has joined #ruby
whathappens has joined #ruby
`derpy has quit [Read error: Connection reset by peer]
adaedra has quit [Read error: Connection reset by peer]
Cohedrin has quit [Read error: Connection reset by peer]
nobitanobi has quit [Ping timeout: 246 seconds]
jgt has quit [Ping timeout: 246 seconds]
nobitanobi has joined #ruby
redaudit has quit [Quit: Cya]
whathappens has quit [Client Quit]
jusa has joined #ruby
cam27 has joined #ruby
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Cohedrin has joined #ruby
andrew9184 has quit [Quit: andrew9184]
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
t-recx has quit [Ping timeout: 268 seconds]
t-recx has joined #ruby
jenrzzz has joined #ruby
d5sx43 has joined #ruby
milardovich has quit [Remote host closed the connection]
muelleme has quit [Ping timeout: 240 seconds]
milardovich has joined #ruby
whathappens has joined #ruby
nobitanobi has quit [Remote host closed the connection]
nobitanobi has joined #ruby
Burgestrand has quit [Quit: Closing time!]
Vingador_ has quit [Ping timeout: 246 seconds]
<SeepingN>
gross
<majuk>
Amen
<majuk>
Almost done making the new file system to try building ruby to try to fix the problem I ran into compiling the mmap gem to get my friggin SPI interface functional.
nobitanobi has quit [Ping timeout: 246 seconds]
<majuk>
Maybe I should just drown myself instead. Probably be more fun.
tildes has joined #ruby
mrconfused has joined #ruby
tristanp has quit [Ping timeout: 260 seconds]
milardovich has quit [Remote host closed the connection]
gusrub has quit [Read error: Connection reset by peer]
rgr has joined #ruby
haylon has quit [Ping timeout: 268 seconds]
gusrub has joined #ruby
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
latemus has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
haylon has joined #ruby
biberu has quit []
mrmax has joined #ruby
MichaelBurge has joined #ruby
cdg has joined #ruby
SaschaVoid has quit [Ping timeout: 246 seconds]
ta_ has joined #ruby
gusrub has quit [Remote host closed the connection]
dionysus69 has joined #ruby
<MichaelBurge>
Hey all. I'm trying to add extra logging to my unit tests and am having a bit of trouble understanding the semantics of &block
nicesignal has quit [Remote host closed the connection]
psychicist__ has quit [Quit: Lost terminal]
nicesignal has joined #ruby
<baweaver>
&block is how you pass a block (as an argument) or capture one (as a method param)
<baweaver>
block.call is just invoking the block
<MichaelBurge>
That's true, but when you wrap it inside of another do..end block it should be equivalent, right?
<mrmax>
Hi! I need some help with string parsing to hash. The string is: <div style="style"><b>First Name</b> Michael<br /><b>Last Name</b> Smith<br /></div> <div style=“another style”><b>Username</b> Michael123<br /><b>Join</b> ,<br /><b>Email:</b> ,<br \></div>. I want to get hash where key is word from <b></b> and value the word after</b> If There is no value after </b> - just “”. What is the best way to do it
<baweaver>
mrmax: Nokogiri
olivi____ has quit [Remote host closed the connection]
<baweaver>
module_eval or class_eval is being used somewhere
ur5us has joined #ruby
<baweaver>
which means that it goes and does odd things to the binding context
<MichaelBurge>
Are you suggesting that self gets rebound to the parent class rather than the module holding my unit tests, so that the instance variables are looked up on the parent class?
ujjain has quit [Read error: Connection reset by peer]
<baweaver>
yeah, shenanigans
<MichaelBurge>
Within the 'do' block, I can see that self is the child class, not the parent
<baweaver>
so &block will keep the context
<baweaver>
block.call in a new block won't
n1299 has joined #ruby
<MichaelBurge>
Okay. Is there a way to preserve the context when invoking it?
<baweaver>
Honestly not entirely sure. You could try local variables but this gets dirty fast.
<baweaver>
Hrm. Not sure I have a really good answer for this one
<matthewd>
instance_exec
<MichaelBurge>
self.instance_eval(&block) inside of the do..end seems to do the trick
mdw has joined #ruby
<baweaver>
yeah, so many levels of meta down and I lose track of what goes where :/
n1299 has quit [Quit: TurboIRC for Android. Available @ Google Play.]
* baweaver
wanders off for coffee
jusa has quit [Ping timeout: 240 seconds]
gusrub has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ujjain has joined #ruby
ujjain has joined #ruby
ujjain has quit [Changing host]
ascarter has joined #ruby
ur5us has quit [Remote host closed the connection]
muelleme has joined #ruby
whathappens has left #ruby ["Bless bless..."]
bkxd has joined #ruby
muelleme has quit [Ping timeout: 268 seconds]
jeffreylevesque has quit [Ping timeout: 268 seconds]
synthroid has quit []
blackmesa has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
d5sx43 has quit [Remote host closed the connection]
sepp2k has quit [Ping timeout: 246 seconds]
haylon has quit [Remote host closed the connection]
haylon has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
milardovich has quit []
jamesaxl has quit [Quit: WeeChat 1.7.1]
ur5us has joined #ruby
juggler has quit [Quit: Leaving]
patarr has joined #ruby
oliv_____ has quit [Ping timeout: 240 seconds]
dviola has quit [Quit: WeeChat 1.8]
milardovich has joined #ruby
jgt has joined #ruby
xall has quit [Quit: xall]
milardovich has quit [Remote host closed the connection]
d5sx43 has joined #ruby
milardovich has joined #ruby
7ITAA4DK1 has quit [Ping timeout: 240 seconds]
7IZAAJZLL has quit [Ping timeout: 258 seconds]
patarr has quit [Ping timeout: 255 seconds]
olivi____ has joined #ruby
patarr has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has quit [Ping timeout: 240 seconds]
d5sx43 has quit [Quit: Leaving...]
haylon has quit [Quit: WeeChat 1.5]
raspado has quit [Remote host closed the connection]
Burgestrand has joined #ruby
raspado has joined #ruby
romank has quit [Read error: Connection reset by peer]
ldnunes has quit [Quit: Leaving]
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JeanCarloMachado has joined #ruby
JeanCarl1Machado has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
majuk_ has joined #ruby
dcluna has quit [Ping timeout: 240 seconds]
SaschaVoid has quit [Quit: die();]
fuzzyhorns1 has quit [Ping timeout: 240 seconds]
mrconfused has quit [Ping timeout: 255 seconds]
dcluna has joined #ruby
jeffreylevesque has joined #ruby
romank has joined #ruby
patarr has joined #ruby
majuk has quit [Ping timeout: 245 seconds]
romank has quit [Read error: Connection reset by peer]
<michael_mbp>
havenwood: what's strange is docs for Tempfile do not go into such detail.
enterprisey has quit [Quit: Leaving]
patarr has quit [Ping timeout: 240 seconds]
majuk_ has quit [Remote host closed the connection]
hahuang65 has quit [Ping timeout: 240 seconds]
SenpaiSilver has quit [Quit: Leaving]
bkxd has joined #ruby
gothicsouth has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
ResidentBiscuit has joined #ruby
skweek has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
patarr has joined #ruby
GodFather has joined #ruby
LukyCZ has quit [Quit: Connection closed for inactivity]
theunraveler has quit []
mattp_ has joined #ruby
milardovich has joined #ruby
cfec0b8d has quit [Remote host closed the connection]
kobain has joined #ruby
kobain has quit [Excess Flood]
kobain has joined #ruby
kobain has quit [Excess Flood]
kobain has joined #ruby
t-recx has quit [Quit: t-recx]
t-recx has joined #ruby
romank has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MichaelBurge has quit [Remote host closed the connection]
<havenwood>
michael_mbp: They do kinda leave a trail of cookie crumbs. Tempfile::new points to File::open for options, which in turn points to IO::new, where the docs lie.
patarr has quit [Ping timeout: 240 seconds]
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
michael_mbp: Fair to say it's not easy to find.
MichaelBurge has joined #ruby
olivi____ has quit [Remote host closed the connection]
milardovich has quit [Ping timeout: 240 seconds]
oliv_____ has joined #ruby
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
patarr has joined #ruby
itarato has quit [Ping timeout: 258 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
ltem has quit [Quit: Leaving]
TomyLobo has quit [Ping timeout: 246 seconds]
Pumukel has quit [Quit: ChatZilla 0.9.93 [Firefox 53.0.2/20170504105526]]
<zenspider>
rawr
<t-recx>
rawr
<zenspider>
MichaelBurge: did you get things figured out? also, why are you adding logging to your unit tests?
<zenspider>
curious wtf was going on... that seems way overly complex
gothicsouth has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
itarato has joined #ruby
<MichaelBurge>
zenspider: self.instance_eval(&block) was enough to resolve the issue. The logging was because my exception objects had additional parameters that I wanted to see, but StandardError's inspect method only gives the message.
<MichaelBurge>
I could've probably overridden inspect to get the information I needed, but I didn't realize it until after
cagomez has joined #ruby
<zenspider>
MichaelBurge: if you're using minitest, assert_raises returns the exception object so you can test anything extra that should be on it
<michael_mbp>
havenwood: gotcha!
<zenspider>
eg e = assert_raises { ...}; assert_equal 42, e.something
cahoots_ has quit [Ping timeout: 255 seconds]
<MichaelBurge>
zenspider: The exception was unexpected, so I wouldn't need an assert.
<MichaelBurge>
Though, maybe you meant for debugging that one test you could add the assert
Burgestrand has quit [Quit: Closing time!]
<zenspider>
either way... if it is unexpected... yeah. I'd go ahead and define inspect on it, or use `pp` after capturing it
mrconfused has joined #ruby
cahoots has joined #ruby
Pumukel has joined #ruby
Guest95673 has joined #ruby
oliv_____ has quit [Remote host closed the connection]
Guest95673 has left #ruby [#ruby]
<zenspider>
ljarvis: wtf was that shit about the infinite loop last night? that roulette code. works fine here. like, completely as you'd expect it to.
<zenspider>
Is this threading on windows being wonky?
ozcanesen has joined #ruby
milardovich has joined #ruby
<matthewd>
zenspider: I think it (the original code) was an infinite loop via tail call recursion
davidmichaelkarr has quit [Quit: Connection closed for inactivity]
<zenspider>
matthewd: I ran his code as-is. works fine (so far). I have notoriously high call stack, but not infinitely high (man that'd be fun to fuck with)
mitt3ns has joined #ruby
<zenspider>
their claim was that the second thread doesn't even start because it gets stuck on the first one. It starts fine.
JeanCarloMachado has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
JeanCarl1Machado has quit [Ping timeout: 260 seconds]
<zenspider>
I did have to turn off the prints because it was obnoxious... but you could see both running fine
JeanCarloMachado has joined #ruby
<matthewd>
Ah, yeah.. maybe just misreading the output. The second thread dies first for me, so the last screenful of output is all "1".
agent_white has quit [Ping timeout: 255 seconds]
JeanCarl1Machado has joined #ruby
mrconfused has quit [Ping timeout: 255 seconds]
* zenspider
shrugs
gnufied has quit [Ping timeout: 240 seconds]
Pumukel has quit [Quit: ChatZilla 0.9.93 [Firefox 53.0.2/20170504105526]]
majuk has joined #ruby
<majuk>
So I'm on Linux and I'd like to install a recent version of ruby-dev without going through package management.
<zenspider>
go for it
mrconfused has joined #ruby
<majuk>
for realz
ResidentBiscuit has quit [Quit: Critical Miss]
volty has joined #ruby
zachk has quit [Remote host closed the connection]
patarr has quit [Ping timeout: 240 seconds]
patarr has joined #ruby
enterprisey has joined #ruby
jusa has joined #ruby
JoshS has quit [Ping timeout: 268 seconds]
zachk has joined #ruby
zachk has quit [Changing host]
zachk has joined #ruby
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
patarr has quit [Ping timeout: 268 seconds]
jusa has quit [Ping timeout: 246 seconds]
bruno-_ has joined #ruby
milardovich has quit [Remote host closed the connection]
hobodave has quit [Quit: Computer has gone to sleep.]
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bkxd has quit [Ping timeout: 246 seconds]
bilal has joined #ruby
mrconfused has quit [Ping timeout: 246 seconds]
mrconfused has joined #ruby
<cam27>
Am I alone in thinking that learning programing through College was tough, because of the vocabulary? I mean, I’m reading this Ruby book now and everything is so much clearer. Take a class method - I am jsut finding out that it is a singleton method that is acted upon by a instance.
<cam27>
Never knew they were linked like that
<majuk>
60% of most college degrees is vocabulary.
Dimik has quit [Ping timeout: 260 seconds]
<majuk>
Some are closer to 95%
<cam27>
I feel like it was just an intro to programing, but to actually understand it, one has to read it for themselves and get out of that teacher student enviornment
<cam27>
Some courses were too fast and some were too slow in my case, both of which hurt my development. I mean I did learn a lot, but not so much in programing, I really feel like it is the worst taught subject out of all of the courses I took.
olivi____ has quit [Remote host closed the connection]
charliesome has joined #ruby
majuk has quit [Remote host closed the connection]
cschneid_ has quit [Remote host closed the connection]
_sfiguser has quit [Quit: Leaving]
<zenspider>
cam27: a call method isn't acted upon by an instance... unless you count the class as the instance (which technically it is, but nobody thinks of it that way)
<zenspider>
grr.. "a CLASS method" ... my fingers aren't cooperating today
milardovich has joined #ruby
nofxx has joined #ruby
lxsameer has quit [Quit: WeeChat 1.7]
<cam27>
zenspider: Good catch on my mistake. Correct, I wrote it wrong. Here is where I just read it from: The idea of a class
<cam27>
method is that you send a message to the object that’s the class rather than to one of
<cam27>
the class’s instances. The message most_expensive goes to the class Ticket, not to a
<cam27>
particular ticket.
istrasci has joined #ruby
<cam27>
So highest mustbe an instance of class? highest = Ticket.most_expensive(th,cc,fg)
<cam27>
puts "The highest-priced ticket is the one for #{highest.venue}."
oliv_____ has joined #ruby
antgel has quit [Ping timeout: 246 seconds]
<istrasci>
HEREDOCs implicitly have a newline at the end that is often undesirable. Is there a way to auto chomp! it in the syntax, or you just have to do it manually?
nowhere_man has quit [Remote host closed the connection]
DLSteve has joined #ruby
im0nde has quit [Ping timeout: 260 seconds]
oliv_____ has quit [Ping timeout: 246 seconds]
itarato has quit [Ping timeout: 246 seconds]
dhollinger has quit [Ping timeout: 240 seconds]
redaudit has joined #ruby
marr has quit [Ping timeout: 246 seconds]
cdg has quit [Remote host closed the connection]
itarato has joined #ruby
jphase has quit [Read error: Connection reset by peer]
nicesignal has quit [Remote host closed the connection]
quiller has quit [Quit: I out! ::mic drop::]
nicesignal has joined #ruby
xenops has quit [Ping timeout: 240 seconds]
jphase has joined #ruby
quiller has joined #ruby
minimalism has quit [Quit: minimalism]
cschneid_ has joined #ruby
BSaboia has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
boombox_ has joined #ruby
Fysicus has quit [Ping timeout: 240 seconds]
cschneid_ has quit [Ping timeout: 246 seconds]
mrconfused has quit [Ping timeout: 246 seconds]
raspado has quit [Remote host closed the connection]
raspado has joined #ruby
brent__ has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
raspado has quit [Ping timeout: 246 seconds]
cagomez has joined #ruby
Fysicus has joined #ruby
KeyJoo has joined #ruby
GodFather has quit [Ping timeout: 272 seconds]
snockerton has joined #ruby
cagomez has quit [Ping timeout: 255 seconds]
boombox_ has quit [Remote host closed the connection]