« Back to channel list

#ruby - 16 May 2017

« Back 1 day Forward 1 day »
[00:01:43] nankyokusei: has joined #ruby
[00:01:52] jrafanie: has joined #ruby
[00:08:16] ascarter: has joined #ruby
[00:11:39] postmodern: has joined #ruby
[00:14:15] jenrzzz: has joined #ruby
[00:14:15] jenrzzz: has joined #ruby
[00:14:20] itarato: has joined #ruby
[00:16:17] itarato: has joined #ruby
[00:18:13] charliesome: has joined #ruby
[00:27:04] swills: has joined #ruby
[00:28:35] jrafanie: has joined #ruby
[00:28:58] BillyTheKid: has joined #ruby
[00:35:36] jusa: has joined #ruby
[00:40:16] DLSteve: has joined #ruby
[00:41:19] jenrzzz: has joined #ruby
[00:41:20] jenrzzz: has joined #ruby
[00:43:19] Lucky_ABA: has joined #ruby
[00:49:46] Trynemjoel: has joined #ruby
[00:51:28] dviola: has joined #ruby
[00:51:32] JeanCarloMachado: has joined #ruby
[00:51:33] JeanCarl1Machado: has joined #ruby
[00:51:51] chouhoulis: has joined #ruby
[00:52:55] apparition: has joined #ruby
[00:53:54] pifon: has joined #ruby
[00:57:14] gusrub: has joined #ruby
[00:57:17] Trynemjoel: has joined #ruby
[00:58:56] JeanCarloMachado: has joined #ruby
[00:59:26] skweek: has joined #ruby
[01:00:22] raspado: has joined #ruby
[01:07:18] mentok: has joined #ruby
[01:08:54] ur5us_: has joined #ruby
[01:10:10] ur5us: has joined #ruby
[01:12:07] xiani: has joined #ruby
[01:14:09] ascarter: has joined #ruby
[01:17:37] milardovich: has joined #ruby
[01:18:32] Trynemjoel: has joined #ruby
[01:19:16] JeanCarl1Machado: has joined #ruby
[01:20:46] charliesome: has joined #ruby
[01:21:58] raul782: has joined #ruby
[01:23:16] jrafanie: has joined #ruby
[01:26:54] mim1k: has joined #ruby
[01:28:51] Newbs: has joined #ruby
[01:29:11] Newbs: Hello. What is samba?
[01:32:19] michael_mbp: hi all how can I open a Tempfile in binmode as a block?
[01:32:33] michael_mbp: from what I've seen it's a case of Tempfil.new(..).binmode
[01:34:38] KeyJoo: has joined #ruby
[01:35:47] raul782: has joined #ruby
[01:37:58] spheric: has joined #ruby
[01:38:40] pb122-two: has joined #ruby
[01:44:22] gizmore|2: has joined #ruby
[01:52:25] gothicsouth: has joined #ruby
[01:54:14] raul782: has joined #ruby
[01:56:12] d^sh: has joined #ruby
[01:57:11] milardovich: has joined #ruby
[02:02:52] nankyokusei: has joined #ruby
[02:03:02] hahuang65: has joined #ruby
[02:08:57] JeanCarl1Machado: has joined #ruby
[02:20:24] genpaku: has joined #ruby
[02:21:24] Jameser: has joined #ruby
[02:25:40] raspado: has joined #ruby
[02:36:21] bruno-: has joined #ruby
[02:36:36] jusa: has joined #ruby
[02:41:04] perniciouscaffei: has joined #ruby
[02:41:49] havenwood: newbs: It's not Ruby-related so it's offtopic for this channel. See: https://orktes.github.io/atom-react/
[02:41:58] havenwood: newbs: Oops, wrong link, see: https://github.com/samba-team/samba
[02:44:59] hahuang65: has joined #ruby
[02:46:03] havenwood: >> Tempfile.create { |file| file.binmode; file.binmode? } # michael_mbp
[02:46:05] ruby[bot]: havenwood: # => uninitialized constant Tempfile (NameError) ...check link for more (https://eval.in/795870)
[02:46:17] havenwood: (if i remembered to require it)
[02:46:47] havenwood: and if the bot was 2.4
[02:47:01] electrostat: has joined #ruby
[02:48:00] xall: has joined #ruby
[02:48:45] havenwood: michael_mbp: you can also bas :binmode option on create
[02:49:16] havenwood: michael_mbp: Tempfile.create(binmode: true) { |file| file.binmode? } #=> true
[02:50:26] duderonomy: has joined #ruby
[02:50:34] JeanCarl1Machado: has joined #ruby
[02:50:46] havenwood: michael_mbp: See options from IO::new: https://ruby-doc.org/core/IO.html#method-c-new
[02:53:43] TechMonger: has joined #ruby
[02:54:08] jenrzzz: has joined #ruby
[02:54:08] jenrzzz: has joined #ruby
[03:04:33] agent_white: has joined #ruby
[03:13:30] jenrzzz: has joined #ruby
[03:16:36] JeanCarl1Machado: has joined #ruby
[03:18:15] hndk: has joined #ruby
[03:18:38] itarato: has joined #ruby
[03:19:23] JeanCarloMachado: has joined #ruby
[03:19:48] raul782: has joined #ruby
[03:23:10] JeanCarl1Machado: has joined #ruby
[03:25:33] jenrzzz: has joined #ruby
[03:25:33] jenrzzz: has joined #ruby
[03:27:28] mim1k: has joined #ruby
[03:28:41] JeanCarloMachado: has joined #ruby
[03:32:57] Tempesta: has joined #ruby
[03:40:09] brent__: has joined #ruby
[03:43:52] apparition: has joined #ruby
[03:44:27] nickjj_: has joined #ruby
[03:48:44] ahrs: has joined #ruby
[03:49:33] perniciouscaffei: has joined #ruby
[03:49:54] claw: has joined #ruby
[03:53:22] gix: has joined #ruby
[04:03:28] gothicsouth: has joined #ruby
[04:03:29] nankyokusei: has joined #ruby
[04:03:49] newbz: has joined #ruby
[04:04:25] jenrzzz: has joined #ruby
[04:06:07] raul782: has joined #ruby
[04:09:02] bipul: has joined #ruby
[04:10:06] astrobunny: has joined #ruby
[04:13:08] perniciouscaffei: has joined #ruby
[04:19:00] hahuang65: has joined #ruby
[04:26:12] mim1k: has joined #ruby
[04:28:42] brent__: has joined #ruby
[04:30:53] auzty: has joined #ruby
[04:32:46] renchan: has joined #ruby
[04:38:54] cyphase: has joined #ruby
[04:49:19] paradisaeidae: has joined #ruby
[04:49:25] paradisaeidae_: has joined #ruby
[04:49:52] cfec0b8d: has joined #ruby
[04:51:35] apparition: has joined #ruby
[05:04:19] AnoHito_: has joined #ruby
[05:05:00] JoshS: has joined #ruby
[05:07:49] AnoHito: has joined #ruby
[05:07:55] apparition: has joined #ruby
[05:08:09] tildes: has joined #ruby
[05:11:27] __Yiota: has joined #ruby
[05:12:37] cschneid_: has joined #ruby
[05:12:56] cschneid_: has joined #ruby
[05:18:55] hahuang65: has joined #ruby
[05:19:30] anisha: has joined #ruby
[05:38:52] Cohedrin: has joined #ruby
[05:42:39] tildes: has joined #ruby
[05:44:20] igniting: has joined #ruby
[05:49:21] charliesome: has joined #ruby
[05:51:12] timredd: has joined #ruby
[05:53:34] dionysus69: has joined #ruby
[05:57:23] Bock: has joined #ruby
[06:00:01] Bock: has joined #ruby
[06:04:23] nankyokusei: has joined #ruby
[06:05:04] DeeJayh: has joined #ruby
[06:07:08] 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.
[06:07:45] p0p0pr37_: has joined #ruby
[06:07:45] p0p0pr37_: has joined #ruby
[06:08:34] PaulCape_: has joined #ruby
[06:09:25] bigkevmcd: has joined #ruby
[06:11:42] aufi: has joined #ruby
[06:15:25] al2o3-cr: has joined #ruby
[06:19:12] Mortomes|Work: has joined #ruby
[06:23:33] eam: DeeJayh: you can use a thread
[06:24:14] 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
[06:24:37] 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
[06:25:19] 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
[06:25:26] DeeJayh: just thought maybe there would be a better way to do this
[06:25:31] jenrzzz: has joined #ruby
[06:25:31] jenrzzz: has joined #ruby
[06:25:46] eam: there are frameworks for this sort of thing
[06:26:06] eam: you can also use separate processes per-connection
[06:26:51] raspado: has joined #ruby
[06:27:11] bambanx: has joined #ruby
[06:28:44] djbkd_: has joined #ruby
[06:33:22] Seenox: has joined #ruby
[06:34:12] burgestrand: has joined #ruby
[06:35:52] conta: has joined #ruby
[06:44:17] vuoto: has joined #ruby
[06:44:44] Hunter1: has joined #ruby
[06:45:02] conta: has joined #ruby
[06:45:50] vuoto: has joined #ruby
[06:46:31] vuoto: has joined #ruby
[06:48:35] somerandomteen: has joined #ruby
[06:49:33] Seenox: Hello. I am trying to use json.parse and json.dump but I think I am stuck... Can someone please check this for me and tell me what I am doing wrong? Thanks => https://gist.github.com/anonymous/61cd20b063d57dd5c04a70ae3b5affc7
[06:55:21] burgestrand: Seenox JSON.dump("#{body}") ===> JSON.dump(body)
[06:56:32] 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
[06:56:56] Seenox: Burgestrand: It worked! Thanks for the explanation.
[06:56:59] burgestrand: Seenox doing JSON.dump("some string representation of body") is not really what you want :)
[06:57:17] blackmesa: has joined #ruby
[06:57:32] Seenox: Now I know why it used to convert my hash to string...
[06:58:28] 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?
[06:59:40] 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
[06:59:57] burgestrand: Seenox in the case with a string, doing "some string".to_s just returns the same string, since it's always a string
[07:00:19] burgestrand: Seenox and I think (not sure) the case with puts, is that it'll call #to_s whatever you give it
[07:01:01] burgestrand: Seenox et voila: https://eval.in/795955
[07:01:08] Seenox: Burgestrand: No matter if it's a hash or array or object or anything else?
[07:01:38] 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
[07:02:07] Seenox: Burgestrand: https://eval.in/795957 ?
[07:03:40] Seenox: Burgestrand: Thanks a lot as always you're so helpful with great explanations.
[07:07:10] user128: has joined #ruby
[07:07:57] user128: hi, on the https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/57660 page, I don't see the diff / code changes. where can I see the actual code change for a particular svn revision?
[07:09:32] jenrzzz: has joined #ruby
[07:09:32] jenrzzz: has joined #ruby
[07:10:35] herwin: there are `diff' links in the files-tree
[07:10:56] herwin: or use the link `view differences' to see the complete commit
[07:11:51] jamesaxl: has joined #ruby
[07:12:50] user128__: has joined #ruby
[07:13:24] paradisaeidae__: has joined #ruby
[07:13:34] paradisaeidae___: has joined #ruby
[07:13:42] user128_: herwin, clicking "view differences" takes me to a login screen. I will find the commit on github; should be easier.
[07:14:13] selim: has joined #ruby
[07:14:18] selim: good morning
[07:14:41] selim: can someone tell me how I can instruct gem to prevent searching for sources online?
[07:15:16] selim: if I do the gem install -l/--local ./gem.file.gem I still get a timeout and afterwards this message
[07:15:33] selim: ERROR: Could not find a valid gem 'chef-ruby-lvm-attrib' (~> 0.0.28), here is why:
[07:20:50] burgestrand: has joined #ruby
[07:21:14] cschneid_: has joined #ruby
[07:21:46] mark_66: has joined #ruby
[07:22:18] rgr: has joined #ruby
[07:27:33] TomyWork: has joined #ruby
[07:28:54] xall: has joined #ruby
[07:28:58] stoffus: has joined #ruby
[07:31:15] gothicsouth: has joined #ruby
[07:31:37] ur5us: has joined #ruby
[07:31:44] raul782: has joined #ruby
[07:34:55] tAn: has joined #ruby
[07:40:11] ^jud: has joined #ruby
[07:42:19] blackmesa: has joined #ruby
[07:44:11] charliesome: has joined #ruby
[07:53:03] Luna_Moonfang: has joined #ruby
[07:55:39] AlexRussia: has joined #ruby
[07:56:25] im0nde: has joined #ruby
[08:02:43] sonicmagister: has joined #ruby
[08:03:56] mikecmpbll: has joined #ruby
[08:05:08] nankyokusei: has joined #ruby
[08:06:01] User458764: has joined #ruby
[08:06:10] otherj: has joined #ruby
[08:08:05] burgestrand: has joined #ruby
[08:09:54] DaniG2k: has joined #ruby
[08:10:15] quobo: has joined #ruby
[08:10:17] DaniG2k: hello all. I am trying to set up Cancancan abilities with a namespaced controller.
[08:10:23] DaniG2k: I've outlined my question here: http://stackoverflow.com/questions/43995803/cancancan-allow-managing-on-namespaced-controller
[08:10:32] DaniG2k: any help much appreciated!
[08:12:54] Silthias: has joined #ruby
[08:14:08] faces: has joined #ruby
[08:14:53] 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
[08:16:19] ljarvis: or maybe add to `authorize_resource`
[08:16:57] ljarvis: ah right maybe it doesn't work like that anymore.. hmm
[08:17:01] ljarvis: cancancan is weird
[08:17:11] tvw: has joined #ruby
[08:17:22] DaniG2k: wish I could use Pundit instead hehe
[08:17:44] ljarvis: why can't you?
[08:17:58] ur5us: has joined #ruby
[08:18:16] tomphp: has joined #ruby
[08:21:06] jaruga: has joined #ruby
[08:21:06] lipoqil: has joined #ruby
[08:21:29] DaniG2k: cause this project is already using Cancancan. Working on it with a team of fools
[08:21:38] marr: has joined #ruby
[08:21:39] DaniG2k: nah it's ok
[08:21:41] DaniG2k: will figure it out
[08:28:25] Beams: has joined #ruby
[08:30:37] tomphp: has joined #ruby
[08:32:04] MrBusiness3: has joined #ruby
[08:33:03] TreyG: has joined #ruby
[08:37:38] mim1k: has joined #ruby
[08:42:06] Surver: has joined #ruby
[08:43:17] xall: has joined #ruby
[08:43:33] User458764: has joined #ruby
[08:48:16] mim1k: has joined #ruby
[08:48:46] pandaant: has joined #ruby
[08:53:17] rgr: has joined #ruby
[08:54:30] xall: has joined #ruby
[08:54:51] leitz: has joined #ruby
[08:56:19] sonic_m: has joined #ruby
[08:56:47] rgr: has joined #ruby
[08:56:59] romank: has joined #ruby
[08:59:46] rgr: has joined #ruby
[09:00:58] sonicmagister: has joined #ruby
[09:01:47] rgr: has joined #ruby
[09:03:43] rgr: has joined #ruby
[09:04:27] sonic_m: has joined #ruby
[09:07:31] aupadhye: has joined #ruby
[09:08:24] sonicmagister: has joined #ruby
[09:08:27] Kug3lis: has joined #ruby
[09:09:16] CrazyEddy: has joined #ruby
[09:11:01] biberu: has joined #ruby
[09:11:46] rgr: has joined #ruby
[09:12:06] ljarvis: go to bed it's late
[09:12:12] zenspider: selim: that "here is why" part seems important
[09:12:20] zenspider: ljarvis: it's only 2am
[09:12:27] ljarvis: so it's.. early?
[09:12:31] zenspider: I have 1-3 hours left. :)
[09:12:55] ljarvis: I can't remember the last time i stayed up that late.. I used to love it, not so much nowadays
[09:13:42] mim1k: has joined #ruby
[09:13:46] rgr: has joined #ruby
[09:14:34] zenspider: it's just the way I'm wired
[09:15:18] DeeJayh: Why, when I call a thread, does my program not advance until the thread is completed? Even in JRuby... so frustrating.
[09:15:43] DeeJayh: Is the point of threads not concurrency...
[09:15:46] rgr: has joined #ruby
[09:16:22] ljarvis: DeeJayh: what do you mean when you call it?
[09:16:26] lxsameer: has joined #ruby
[09:19:54] ferr: has joined #ruby
[09:20:37] DeeJayh: ljarvis, https://gist.github.com/Ruined1/6fea662e1bdadf5410569ad91c4446f9
[09:21:30] ljarvis: DeeJayh: what's happening vs what you expect? I would expect that problem to exit almost immediately due to the main thread exiting
[09:21:46] rgr: has joined #ruby
[09:21:50] DeeJayh: ok so add a loop{} on the end of it
[09:22:15] DeeJayh: actually forget the loop
[09:22:16] DeeJayh: you're right
[09:22:17] workmad3: has joined #ruby
[09:22:20] DeeJayh: I'd expect it to end
[09:22:22] DeeJayh: but it doesnt
[09:22:35] DeeJayh: it just keeps looping inside roulette
[09:22:37] ljarvis: the program that you pasted in its entirety does not end?
[09:23:52] ljarvis: also, your program should cause a stack level error
[09:23:56] ljarvis: you can't do what you're doing
[09:24:03] DeeJayh: I've updated it as shown in the gist
[09:24:05] jenrzzz: has joined #ruby
[09:24:08] DeeJayh: if you refresh the page
[09:24:24] DeeJayh: and it just does betting1roll1betting1roll1 infinitely
[09:24:49] ljarvis: it exits immediately because there's nothing blocking the main thread. What Ruby version and OS are you on?
[09:25:44] 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
[09:26:06] DeeJayh: version is irrelevent, I tried ruby 2.3.3, jruby (mine uses 2.3.1) both on windows
[09:26:11] ljarvis: right, hence me asking what Ruby version and OS you're on, because that's not the behaviour I would expect
[09:26:21] DeeJayh: see, what you're saying it should do, is what I EXPECT it to do
[09:26:25] DeeJayh: but it isnt...
[09:26:50] DeeJayh: repl.it does the same thing
[09:26:56] DeeJayh: https://repl.it/languages/ruby
[09:27:18] DeeJayh: it uses 2.3.1p112
[09:27:46] rgr: has joined #ruby
[09:27:53] sonicmagister: has joined #ruby
[09:29:03] ljarvis: Thread.new on repl.it does not block the main thread..
[09:29:18] DeeJayh: I'm seeing this now with my new test
[09:29:24] DeeJayh: that's how it's supposed to work right?
[09:29:40] DeeJayh: Threads are non-blocking
[09:29:42] rgr: has joined #ruby
[09:30:18] xall: has joined #ruby
[09:30:44] DeeJayh: one thing is, it seems like the roulette thread eventually dies on it's own on REPL
[09:31:07] DeeJayh: https://gist.github.com/Ruined1/6fea662e1bdadf5410569ad91c4446f9
[09:31:34] DeeJayh: if you run that in repl.it, the roll1betting1 will eventually die out and it will just print TEST every 5 seconds
[09:31:53] nowhere_man: has joined #ruby
[09:31:54] DeeJayh: also, why does it never print the crash? there's never any roll2 or betting 2
[09:32:33] ljarvis: DeeJayh: as I mentioned, there's a stack level error in your code. set
[09:32:34] ljarvis: Thread.abort_on_exception = true
[09:34:20] DeeJayh: I'm afraid I don't understand how to implement that, let me search google
[09:34:45] ljarvis: DeeJayh: just add Thread.abort_on_exception = true to the top of your script
[09:35:07] jenrzzz: has joined #ruby
[09:35:22] DeeJayh: stack level too deep
[09:35:50] ljarvis: >> class A; def foo; bar; end; def bar; foo; end; end; A.new.foo
[09:35:51] ruby[bot]: ljarvis: # => stack level too deep (SystemStackError) ...check link for more (https://eval.in/796349)
[09:35:54] ljarvis: you can't do that
[09:36:41] DeeJayh: ok so you cannot use method calls to create an infinite thread is what that's telling me
[09:37:04] DeeJayh: cant call b from a then a from b etc etc
[09:37:42] alazred: has joined #ruby
[09:37:42] alazred: has joined #ruby
[09:37:42] rgr: has joined #ruby
[09:38:26] ljarvis: you'd need to use a loop
[09:38:33] DeeJayh: what about Thread.new { loop { roulette.betting } }
[09:38:35] ljarvis: loop { foo; bar; }
[09:39:18] DeeJayh: can I JUST call betting, then have betting call roll, then when there's no instructions left in roll the thread will just die on it's own?
[09:39:32] DeeJayh: or rather start over, because of the loop?
[09:39:34] SaschaVoid: has joined #ruby
[09:39:46] rgr: has joined #ruby
[09:39:55] DeeJayh: well I guess there's one way to find out lol
[09:39:59] DeeJayh: thank you for the assistance
[09:40:04] ljarvis: yes, the stack level won't be insane in that case (infinite in your prev example)
[09:40:15] DeeJayh: going to play around with it, I'll come back if I'm too dense to comprehend it
[09:40:21] DeeJayh: ljarvis, thank you very much
[09:40:26] ljarvis: no worries, have fun
[09:40:57] flying: has joined #ruby
[09:41:47] rgr: has joined #ruby
[09:42:14] rikkipitt: has joined #ruby
[09:44:03] DeeJayh: Yup, nailed it, my journey continues!
[09:49:30] ferr: has joined #ruby
[09:51:06] User458764: has joined #ruby
[09:53:46] rgr: has joined #ruby
[09:54:54] DeeJayh: does anyone know why jruby refuses to take a range for a random number?
[09:55:25] DeeJayh: In regular ruby I can do SecureRandom.random_number(50..100)In regular ruby I can do SecureRandom.random_number(50..100)
[09:55:48] DeeJayh: but in JRuby it throws an error stating I'm using a Range for a fixnum
[09:57:46] rgr: has joined #ruby
[09:57:51] ljarvis: DeeJayh: current jruby targets an older version of ruby, perhaps old enough that random_number did not accept a range
[09:58:21] ljarvis: ah right, latest targets 2.3, so maybe it's a bug. I'm not sure
[09:58:28] DeeJayh: jruby uses 2.3.1 if I'm not mistaken, repl.it, too, uses 2.3.1 and it works fine.
[09:58:40] DeeJayh: Probably a bug
[09:58:42] ljarvis: headius: ^
[09:58:57] DeeJayh: any alternative tricky way beat it for now?
[09:59:01] DeeJayh: I'm stumped :(
[09:59:40] ljarvis: DeeJayh: write your own implementation based on https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/securerandom.rb#L147
[10:00:32] DeeJayh: I should probably also open an issue there then while I'm at it
[10:00:38] DeeJayh: About the bug
[10:00:45] psychicist__: has joined #ruby
[10:00:49] ljarvis: yes I think that'd be helpful to the jruby folks
[10:00:55] mim1k: has joined #ruby
[10:01:09] Mortomes|Work: has joined #ruby
[10:03:43] 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
[10:03:44] rgr: has joined #ruby
[10:04:31] awille: has joined #ruby
[10:04:39] User458764: has joined #ruby
[10:06:01] nankyokusei: has joined #ruby
[10:08:10] sonicmagister: has joined #ruby
[10:10:40] sonicmagister: has joined #ruby
[10:13:37] Hunter1: has joined #ruby
[10:18:26] mim1k: has joined #ruby
[10:22:41] nobitanobi: has joined #ruby
[10:28:36] raspado: has joined #ruby
[10:32:55] xall: has joined #ruby
[10:38:44] burgestrand: has joined #ruby
[10:38:48] zapata: has joined #ruby
[10:40:30] itarato: has joined #ruby
[10:40:53] Hunter1: has joined #ruby
[10:47:20] sleetdrop: has joined #ruby
[10:50:48] burgestrand: has joined #ruby
[10:51:46] itarato: has joined #ruby
[10:59:38] jenrzzz: has joined #ruby
[10:59:58] mim1k: has joined #ruby
[11:01:07] pankaj_: has joined #ruby
[11:02:08] burgestrand: has joined #ruby
[11:03:11] genpaku: has joined #ruby
[11:10:09] antgel: has joined #ruby
[11:10:41] auzty: has joined #ruby
[11:11:04] Hunter1: has joined #ruby
[11:11:42] cfec0b8d: has joined #ruby
[11:14:06] burgestrand: has joined #ruby
[11:15:03] DoubleMalt: has joined #ruby
[11:18:41] nobitanobi: has joined #ruby
[11:24:48] kke: hmm what's this: def border(options=(not_set=true)
[11:25:56] kke: keyword argument defaulting?
[11:26:05] burgestrand: has joined #ruby
[11:28:41] kke: no. something even more exotic.
[11:30:09] tlaxkit: has joined #ruby
[11:31:10] bonhoeffer: has joined #ruby
[11:31:51] kke: border('foo') --> options == 'foo', not_set = nil border() --> options = true, not_set = true.
[11:33:33] TechMonger: has joined #ruby
[11:37:54] Jameser: has joined #ruby
[11:39:33] blackmesa: has joined #ruby
[11:40:55] tvw: has joined #ruby
[11:40:58] 7IZAAJZLL: has joined #ruby
[11:40:58] 7ITAA4DK1: has joined #ruby
[11:42:03] milardovich: has joined #ruby
[11:46:23] milardovich: has joined #ruby
[11:46:37] ldnunes: has joined #ruby
[11:54:14] Vingador: has joined #ruby
[11:57:46] pankaj_: has joined #ruby
[11:58:24] shinnya: has joined #ruby
[11:58:49] tgragnato: has joined #ruby
[11:59:07] synthroid: has joined #ruby
[12:01:37] blackmesa: has joined #ruby
[12:04:11] fmcgeough: has joined #ruby
[12:06:20] rtjh: has joined #ruby
[12:06:32] apparition: has joined #ruby
[12:06:52] nankyokusei: has joined #ruby
[12:07:12] maattdd: has joined #ruby
[12:08:15] fmcgeough_: has joined #ruby
[12:08:52] bonhoeffer: has joined #ruby
[12:10:43] nadir: has joined #ruby
[12:12:06] flyingX: has joined #ruby
[12:15:04] sepp2k: has joined #ruby
[12:16:47] Mortomes|Train: has joined #ruby
[12:18:24] gnufied: has joined #ruby
[12:19:15] uZiel: has joined #ruby
[12:19:21] AlexRussia: has joined #ruby
[12:21:07] cschneid_: has joined #ruby
[12:23:03] stoffus1: has joined #ruby
[12:23:21] uZiel: what would be the best way to xor each byte of a given hex with a given byte?
[12:24:13] uZiel: aah, got it .bytes
[12:24:57] nemish: has joined #ruby
[12:26:05] pupsicle: has joined #ruby
[12:27:32] uZiel: no that didn't work actually, because the hex is given as string, like "2785d9e4"
[12:27:59] kristoff_: has joined #ruby
[12:28:12] uZiel: how do I return 27^x 85^x d9^x e4^x ?
[12:28:49] matthewd: uZiel: Try unpack
[12:30:07] flying: has joined #ruby
[12:34:22] BSab: has joined #ruby
[12:39:32] nobitanobi: has joined #ruby
[12:40:50] Xiti`: has joined #ruby
[12:40:58] Xiti`: has joined #ruby
[12:42:32] bonhoeffer: has joined #ruby
[12:50:46] skweek: has joined #ruby
[12:56:02] olivier__: has joined #ruby
[12:56:54] ged: has joined #ruby
[12:57:13] mahlon: has joined #ruby
[12:57:24] psychicist__: has joined #ruby
[12:58:12] itarato: has joined #ruby
[12:59:48] devyn: has joined #ruby
[13:02:29] cdg: has joined #ruby
[13:04:56] bkxd: has joined #ruby
[13:09:51] User458764: has joined #ruby
[13:11:15] itarato: has joined #ruby
[13:13:52] burgestrand: has joined #ruby
[13:15:49] redaudit: has joined #ruby
[13:21:24] Hanmac: has joined #ruby
[13:23:18] xall: has joined #ruby
[13:23:31] charliesome: has joined #ruby
[13:24:06] etehtsea: has joined #ruby
[13:24:37] romank: has joined #ruby
[13:25:52] dviola: has joined #ruby
[13:26:08] skweek: has joined #ruby
[13:28:21] awille: has joined #ruby
[13:28:44] flying: has joined #ruby
[13:34:06] bruno-: has joined #ruby
[13:34:27] DLSteve: has joined #ruby
[13:36:31] workmad3: has joined #ruby
[13:37:20] itarato: has joined #ruby
[13:37:58] t-recx: has joined #ruby
[13:40:32] arooni: has joined #ruby
[13:43:59] nobitano_: has joined #ruby
[13:44:15] olivier__: has joined #ruby
[13:44:42] fuzzyhorns1: has joined #ruby
[13:46:28] fuzzyhorns1: has joined #ruby
[13:47:31] NeoMalachi: has joined #ruby
[13:49:57] dionysus69: has joined #ruby
[13:55:55] AlexRussia: has joined #ruby
[13:57:12] andrew9184: has joined #ruby
[13:59:09] SaschaVoid: has joined #ruby
[14:00:11] jaruga: has joined #ruby
[14:00:22] mim1k: has joined #ruby
[14:00:29] ahrs: has joined #ruby
[14:01:42] jrafanie: has joined #ruby
[14:02:45] chouhoulis: has joined #ruby
[14:05:08] xenops: has joined #ruby
[14:07:48] olivier__: has joined #ruby
[14:07:49] nankyokusei: has joined #ruby
[14:09:53] romank: has joined #ruby
[14:13:16] theunraveler: has joined #ruby
[14:19:55] Asher: has joined #ruby
[14:21:57] mim1k: has joined #ruby
[14:24:03] dlitvak: has joined #ruby
[14:26:30] DoubleMalt: has joined #ruby
[14:26:56] olivier__: has joined #ruby
[14:28:48] pankaj_: has joined #ruby
[14:29:20] Emmanuel_Chanel: has joined #ruby
[14:31:59] igniting: has joined #ruby
[14:33:26] tlaxkit: has joined #ruby
[14:34:16] GodFather: has joined #ruby
[14:35:14] bigkevmcd: has joined #ruby
[14:35:23] kaspergrubbe: has joined #ruby
[14:36:06] SuperTux88: has joined #ruby
[14:36:40] haylon: has joined #ruby
[14:37:00] Benshiro: has joined #ruby
[14:37:42] mikecmpb_: has joined #ruby
[14:39:35] fuzzyhorns1: has joined #ruby
[14:39:37] tlaxkit: has joined #ruby
[14:40:11] User458764: has joined #ruby
[14:42:56] AlexRussia: has joined #ruby
[14:48:02] blackmesa: has joined #ruby
[14:50:44] chouhoulis: has joined #ruby
[14:52:43] itarato: has joined #ruby
[14:53:07] cahoots: has joined #ruby
[14:53:44] manveru: >> 'hello world'.bytes.to_a.map{|b| b ^ 100 }
[14:53:45] ruby[bot]: manveru: # => [12, 1, 8, 8, 11, 68, 19, 11, 22, 8, 0] (https://eval.in/798451)
[14:53:52] manveru: >> 'hello world'.bytes.map{|b| b ^ 100 }
[14:53:53] ruby[bot]: manveru: # => [12, 1, 8, 8, 11, 68, 19, 11, 22, 8, 0] (https://eval.in/798452)
[14:53:57] manveru: or that :)
[14:54:56] 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?
[14:55:34] dminuoso: cahoots: You usually use the File helper methods to construct paths together with __FILE__
[14:55:45] dminuoso: And avoid chdir entirely
[14:56:05] dminuoso: i.e. File.dirname(__FILE__) is something you see an awful lot in Ruby programs
[14:56:15] dminuoso: It's an established pattern I guess.
[14:56:38] dminuoso: That avoids messing with the pwd entirely.
[14:56:58] cahoots: dminuoso, hmm, i like mine more i guess
[14:57:22] cahoots: it seems cleaner in the long run
[14:57:25] dminuoso: cahoots: Except File.dirname(__FILE__) gives you precise semantics. chdir has some nasty side-effects
[14:57:32] dminuoso: cahoots: Imagine your application crashes at some point.
[14:57:54] elomatreb: IIRC chdir has a block form that automatically changes back, if you're OK with wrapping your whole program in a block
[14:58:04] elomatreb: But yeah, I agree with dminuoso
[14:58:13] raul782: has joined #ruby
[14:58:23] dminuoso: cahoots: And as I mentioned, it's an established pattern in the Ruby community. :)
[14:58:56] cahoots: i don't understand what the side effecs are, certainly my shell doesn't get its pwd changed
[14:59:16] cahoots: and wouldn't __dir__ be more concise?
[15:00:04] kyeeh: has joined #ruby
[15:00:17] dminuoso: cahoots: __dir__ is a method, __FILE__ is a constant.
[15:00:28] ahrs: has joined #ruby
[15:01:13] cahoots: i don't see the significance
[15:01:26] dminuoso: cahoots: Mmm, But actually you are right __dir__ is actually more elegant.
[15:01:35] dminuoso: Guess old habits die hard.
[15:01:47] chouhoul_: has joined #ruby
[15:01:48] dminuoso: File.expand_path(__dir__, '../foo') is the way to go
[15:02:17] cahoots: it seems like properness is correlated with verboseness
[15:02:29] chouhoul_: has joined #ruby
[15:03:03] dminuoso: cahoots: Writing code is not about trying to save as much characters as possible. chdir gives you state machine semantics.
[15:03:11] dminuoso: Which is that much more difficult to reason about.
[15:03:28] dminuoso: cahoots: Let's say you call some code. Do you know whether that code did a ninja change to the cwd?
[15:03:47] cahoots: it doesn't matter if my project adopts a consistent structure
[15:03:54] dminuoso: cahoots: Can you say the same about any library you use.
[15:04:37] 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
[15:04:42] Kug3lis: has joined #ruby
[15:04:43] 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
[15:05:02] dminuoso: It's much more difficult to just using File.expand_path(__dir__, 'foo')
[15:05:13] dminuoso: Because any code can mutate it.
[15:05:16] cfec0b8d: has joined #ruby
[15:05:21] dminuoso: Mutable globals are bad. Always.
[15:05:30] dminuoso: They stink of poor code design.
[15:05:41] dminuoso: They are also downright impossible to test.
[15:06:00] cahoots: the great thing about ruby is you can do it lots of ways, so i'll stick with mine
[15:06:12] rippa: has joined #ruby
[15:06:38] dminuoso: That does not mean that most ways are sensible.
[15:06:44] dminuoso: But luckily I dont car.e
[15:06:53] itarato: has joined #ruby
[15:08:24] elomatreb: Did you see that block form of chdir I mentioned? Might at least help with the cleaning up part
[15:08:48] __Yiota: has joined #ruby
[15:09:47] raspado: has joined #ruby
[15:10:04] cahoots: yeah i'll check it out
[15:10:10] cahoots: thanks for the advice dminuoso elomatreb
[15:10:19] raul782: has joined #ruby
[15:12:35] dellavg: has left #ruby: ("Ex-Chat")
[15:12:55] cdg: has joined #ruby
[15:13:56] Silthias1: has joined #ruby
[15:14:54] cschneid_: has joined #ruby
[15:15:48] LuckyABA: has joined #ruby
[15:17:00] Beams: has joined #ruby
[15:19:11] zapata: has joined #ruby
[15:19:58] etehtsea: has joined #ruby
[15:20:07] bkxd: has joined #ruby
[15:22:13] gothicsouth: has joined #ruby
[15:24:01] bmgoog: has joined #ruby
[15:28:23] jespada: has joined #ruby
[15:29:04] mikecmpbll: has joined #ruby
[15:29:11] mrgrieves: has joined #ruby
[15:29:19] hobodave: has joined #ruby
[15:29:47] itarato: has joined #ruby
[15:30:27] pankaj_: has joined #ruby
[15:30:38] 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
[15:30:40] mim1k: has joined #ruby
[15:30:47] cam27: has joined #ruby
[15:31:12] matthewd: mrgrieves: A process can't affect its parent's environment
[15:32:15] duderonomy: has joined #ruby
[15:33:03] Beams: has joined #ruby
[15:34:50] rkazak: has joined #ruby
[15:35:25] mrgrieves: matthewd: so I guess my best option is to do this from within a bash script?
[15:37:01] brent__: has joined #ruby
[15:37:14] 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
[15:37:20] brent__: has joined #ruby
[15:37:54] mrgrieves: matthewd: cheers!
[15:37:57] 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
[15:39:43] brent__: has joined #ruby
[15:39:57] xychix: has joined #ruby
[15:41:26] mdw: has joined #ruby
[15:41:45] ascarter: has joined #ruby
[15:42:28] pankaj_: has joined #ruby
[15:42:47] brent__: has joined #ruby
[15:43:02] haylon: has joined #ruby
[15:43:25] brent__: has joined #ruby
[15:43:42] brent__: has joined #ruby
[15:45:22] mas886: has joined #ruby
[15:47:58] 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?
[15:48:28] bruno-: has joined #ruby
[15:48:38] User458764: has joined #ruby
[15:49:26] ascarter: has joined #ruby
[15:49:51] elomatreb: mas886: Could demo what you mean with a small snippet? I'm not really sure I understand
[15:50:16] mas886: elomatreb: Okay I will do a little example.
[15:52:46] mas886: elomatreb: https://pastebin.com/pwNYWZ54
[15:52:47] ruby[bot]: mas886: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/b9e42271b7a853f9421a10e0c100e88a
[15:52:47] ruby[bot]: mas886: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[15:53:11] mas886: Thanks there mr bot
[15:55:16] baweaver: you clipped some of the code there.
[15:55:21] bigkevmcd: has joined #ruby
[15:55:25] baweaver: (well, a lot of the code there)
[15:55:33] mas886: baweaver: clipped?
[15:55:41] baweaver: You do know hashes and arrays are different
[15:56:04] juggler: has joined #ruby
[15:56:08] mas886: baweaver: Of course, but I'm new to ruby. I want to use something like php arrays.
[15:56:18] baweaver: hash = {key: value}; array = [list, of, items]
[15:56:32] baweaver: a hash is basically a dictionary of KV pairs
[15:56:46] baweaver: are you trying to get a wordcount?
[15:56:55] xall: has joined #ruby
[15:57:25] 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.
[15:57:40] baweaver: what's the actual task you're trying to accomplish here?
[15:57:49] amclain: has joined #ruby
[15:58:16] mas886: Get a key assoc list where the a key have a value.
[15:58:21] mas886: The key is created that way.
[15:59:37] baweaver: but what's the buffer?
[15:59:56] mas886: baweaver: Sorry if I cannot give you more information. I'm trying to reverse engeneering some code.
[15:59:58] baweaver: you're not telling me the task, you're telling me how a hash works
[16:00:19] mas886: The buffer is those \n things * for a number
[16:00:24] haylon: has joined #ruby
[16:00:27] mas886: And then I add the things.
[16:00:28] baweaver: I can see that
[16:00:37] mas886: So you know the same I do.
[16:00:48] baweaver: You have a lot of extra code context
[16:01:11] baweaver: It makes no real sense
[16:01:21] mas886: Haha I know.
[16:01:31] 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
[16:02:05] mas886: Isn't there a way to assign the object value as the key instead of the object itself?
[16:02:10] [Butch]: has joined #ruby
[16:02:17] patarr: has joined #ruby
[16:02:56] Pumukel: has joined #ruby
[16:02:59] elomatreb: Now we're getting philosophical, what is an object besides its value? :P
[16:05:27] 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
[16:05:47] olivier__: has joined #ruby
[16:05:57] elomatreb: I.e. `$hash[buf.dup]=chr`
[16:06:15] gusrub: has joined #ruby
[16:06:50] davidmichaelkarr: has joined #ruby
[16:07:52] andrew9184: has joined #ruby
[16:08:09] hosas: has joined #ruby
[16:08:49] havenwood: mas886: Don't assign your own global variables.
[16:08:50] havenwood: mas886: I'd suggest taking a step back to look at more Rubyish ways to achieve your goal.
[16:09:06] baweaver: havenwood: not their code it seems
[16:09:13] havenwood: baweaver: aha
[16:09:15] hosas: has left #ruby: ()
[16:09:19] baweaver: more of a wtf is this question
[16:10:25] mas886: Haha, sorry.
[16:10:32] mas886: Anyways thanks people.
[16:11:04] oleo: has joined #ruby
[16:11:11] Vingador_: has joined #ruby
[16:12:30] skweek: has joined #ruby
[16:13:24] olivier__: has joined #ruby
[16:14:21] nitric: has joined #ruby
[16:19:31] 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 ...
[16:19:34] bkxd: has joined #ruby
[16:21:49] elomatreb: guardian: You can certainly validate the format, but I don't think Ruby ships with a table. Your OS might though
[16:22:01] guardian: ok a regex it is then :) thanks
[16:22:21] kobain: has joined #ruby
[16:22:39] im0nde: has joined #ruby
[16:26:12] _sfiguser: has joined #ruby
[16:29:15] patr0clus: has joined #ruby
[16:29:30] rakm: has joined #ruby
[16:29:49] tildes: has joined #ruby
[16:29:59] milardovich: has joined #ruby
[16:32:50] jackrandom: has joined #ruby
[16:32:56] vuoto: has joined #ruby
[16:33:01] __Yiota: has joined #ruby
[16:34:51] itarato: has joined #ruby
[16:38:07] AlexRussia: has joined #ruby
[16:39:17] nankyokusei: has joined #ruby
[16:39:55] olivier__: has joined #ruby
[16:40:02] jackrandom: has joined #ruby
[16:42:06] fuzzyhorns1: has joined #ruby
[16:42:41] rgr: has joined #ruby
[16:42:54] alazred: has joined #ruby
[16:42:54] alazred: has joined #ruby
[16:42:56] minimalism: has joined #ruby
[16:45:48] etehtsea: has joined #ruby
[16:46:01] skweek: has joined #ruby
[16:48:08] jeffreylevesque: has joined #ruby
[16:48:29] jeffreylevesque: is this valid syntax for multiline string in ruby - https://bpaste.net/show/eb5cb3aa4ed2?
[16:50:36] nemish: has left #ruby: ()
[16:50:52] rkazak: has joined #ruby
[16:51:18] anisha: has joined #ruby
[16:52:06] baweaver: Does it run?
[16:52:58] baweaver: If it does, it's valid. If not...
[16:53:39] synthroid: has joined #ruby
[16:54:58] synthroid: has joined #ruby
[16:55:49] hahuang65: has joined #ruby
[16:57:24] olivier__: has joined #ruby
[16:57:52] jgt: has joined #ruby
[16:59:15] majuk: has joined #ruby
[16:59:50] fuzzyhorns1: has joined #ruby
[17:00:50] 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.
[17:01:12] majuk: Any questions or comments appreciated.
[17:01:25] majuk: The specific gem is 'mmap'
[17:01:45] majuk: ruby 2.2.2
[17:02:57] fuzzyhorns1: majuk: looks like that gem has trouble with rubies of 2 and over? https://github.com/tenderlove/mmap/issues/6
[17:03:11] fuzzyhorns1: https://github.com/tenderlove/mmap/issues/1
[17:03:41] fuzzyhorns1: majuk: see the bottom of the second link: it appears you need to source from git not rubygems
[17:04:23] majuk: fuzzyhorns1: I found that, the git link is dead.
[17:04:33] zachk: has joined #ruby
[17:05:08] majuk: nevermind
[17:06:23] anisha: has joined #ruby
[17:09:29] olivier__: has joined #ruby
[17:09:42] Asher: has joined #ruby
[17:10:08] Cohedrin: has joined #ruby
[17:12:39] mikecmpbll: has joined #ruby
[17:13:41] bkxd: has joined #ruby
[17:13:42] olivier__: has joined #ruby
[17:17:18] gil_: has joined #ruby
[17:20:28] whathappens: has joined #ruby
[17:21:05] swills: has joined #ruby
[17:21:38] jrafanie: has joined #ruby
[17:22:08] anisha: has joined #ruby
[17:22:14] rickumali: has joined #ruby
[17:22:16] whathappens: has joined #ruby
[17:24:31] muelleme: has joined #ruby
[17:28:19] griffindy: has joined #ruby
[17:30:05] _sfiguser: has joined #ruby
[17:30:52] nowhere_man: has joined #ruby
[17:31:11] hahuang65: has joined #ruby
[17:31:33] hahuang65: has joined #ruby
[17:32:03] hahuang65: has joined #ruby
[17:33:23] whathapp_: has joined #ruby
[17:33:37] cahoots_: has joined #ruby
[17:34:01] jeffreylevesque: just needed to escape quotes
[17:34:35] DrCode: has joined #ruby
[17:36:17] milardovich: has joined #ruby
[17:37:41] TomyLobo: has joined #ruby
[17:40:00] jrafanie: has joined #ruby
[17:42:13] griffindy: has joined #ruby
[17:42:49] Cohedrin: has joined #ruby
[17:43:08] uZiel: has joined #ruby
[17:43:23] DrCode: has joined #ruby
[17:44:01] dunk: has joined #ruby
[17:44:11] graingert: has joined #ruby
[17:45:02] swgillespie: has joined #ruby
[17:45:14] Dimik: has joined #ruby
[17:45:22] enterprisey: has joined #ruby
[17:45:38] knowtheory: has joined #ruby
[17:45:42] cfec0b8d: has joined #ruby
[17:46:01] jcp___: has joined #ruby
[17:46:06] AlexRussia: has joined #ruby
[17:46:38] swills: has joined #ruby
[17:47:31] Majost: has joined #ruby
[17:49:44] milardovich: has joined #ruby
[17:50:12] duderonomy: has joined #ruby
[17:50:20] swills: has joined #ruby
[17:56:06] zacts: has joined #ruby
[17:57:33] dasher00: has joined #ruby
[17:58:11] im0nde: has joined #ruby
[18:01:00] TvL2386_: has joined #ruby
[18:01:01] milardovich: has joined #ruby
[18:04:45] __Yiota: has joined #ruby
[18:04:45] gusrub: has joined #ruby
[18:08:18] milardovich: has joined #ruby
[18:11:13] milardovich: has joined #ruby
[18:15:30] anisha_: has joined #ruby
[18:15:57] burgestrand: has joined #ruby
[18:18:11] gothicsouth: has joined #ruby
[18:21:15] ForeignBiscuit: has joined #ruby
[18:21:42] ldnunes: has joined #ruby
[18:23:48] haylon: has joined #ruby
[18:29:43] Cohedrin: has joined #ruby
[18:30:49] mim1k: has joined #ruby
[18:31:12] jokke: has joined #ruby
[18:34:47] Asher: has joined #ruby
[18:35:29] tildes: has joined #ruby
[18:36:32] redaudit: has joined #ruby
[18:36:51] olivier__: has joined #ruby
[18:38:20] mim1k: has joined #ruby
[18:40:28] majuk: has joined #ruby
[18:43:28] alazred: has joined #ruby
[18:43:29] alazred: has joined #ruby
[18:44:16] __Yiota: has joined #ruby
[18:49:16] haylon: has joined #ruby
[18:49:28] im0nde_: has joined #ruby
[18:52:54] ResidentBiscuit: has joined #ruby
[19:00:03] ascarter: has joined #ruby
[19:00:28] milardovich: has joined #ruby
[19:01:21] blackmesa: has joined #ruby
[19:01:56] bkxd: has joined #ruby
[19:03:20] SeepingN: has joined #ruby
[19:04:25] milardovich: has joined #ruby
[19:06:07] cabraturgo: has joined #ruby
[19:06:36] burgestrand: has joined #ruby
[19:06:38] synthroid: has joined #ruby
[19:07:14] cabraturgo: has left #ruby: ()
[19:07:47] tildes: has joined #ruby
[19:07:55] majuk: Can someone recommend a guide for compiling ruby? Thanks in advance.
[19:08:12] ltem: has joined #ruby
[19:09:08] whathapp_: has joined #ruby
[19:12:07] MrBusiness3: has joined #ruby
[19:14:01] havenwood: majuk: Here are some basics: https://github.com/postmodern/chruby/wiki/Ruby
[19:14:17] ascarter: has joined #ruby
[19:14:27] majuk: havenwood: Thanks.
[19:14:34] whathappens: has joined #ruby
[19:15:17] havenwood: majuk: This is a good place to ask if you have related questions.
[19:15:38] majuk: So many questions, but none are very constructive. :D
[19:17:19] majuk: I am pretty far down a rabbit hole at this point. It's dark down here, I don't recommend anyone join me.
[19:17:42] majuk: Aaaaand I just filled my SDCard. -.-
[19:21:37] milardovich: has joined #ruby
[19:25:56] romank: has joined #ruby
[19:27:13] enterprisey: has joined #ruby
[19:27:33] whathappens: has joined #ruby
[19:27:42] oleo: has joined #ruby
[19:28:04] bambanx: has joined #ruby
[19:28:50] lxsameer: has joined #ruby
[19:29:14] xall: has joined #ruby
[19:29:27] armyriad: has joined #ruby
[19:34:55] jgt: has joined #ruby
[19:35:02] nobitanobi: has joined #ruby
[19:36:08] olivier__: has joined #ruby
[19:36:23] LukyCZ: has joined #ruby
[19:36:57] whathappens: has joined #ruby
[19:40:22] nobitanobi: has joined #ruby
[19:41:48] jusa: has joined #ruby
[19:41:54] cam27: has joined #ruby
[19:43:00] Cohedrin: has joined #ruby
[19:45:50] milardovich: has joined #ruby
[19:47:20] t-recx: has joined #ruby
[19:48:02] jenrzzz: has joined #ruby
[19:48:25] d5sx43: has joined #ruby
[19:48:50] milardovich: has joined #ruby
[19:49:49] whathappens: has joined #ruby
[19:52:46] nobitanobi: has joined #ruby
[19:56:46] 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.
[19:57:04] majuk: Maybe I should just drown myself instead. Probably be more fun.
[20:00:03] tildes: has joined #ruby
[20:01:28] mrconfused: has joined #ruby
[20:04:57] rgr: has joined #ruby
[20:05:36] gusrub: has joined #ruby
[20:05:38] milardovich: has joined #ruby
[20:05:52] milardovich: has joined #ruby
[20:06:44] latemus: has joined #ruby
[20:07:59] haylon: has joined #ruby
[20:09:58] mrmax: has joined #ruby
[20:12:51] MichaelBurge: has joined #ruby
[20:13:44] cdg: has joined #ruby
[20:14:45] tAn: has joined #ruby
[20:15:53] dionysus69: has joined #ruby
[20:16:13] 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
[20:16:25] MichaelBurge: What are the differences in how these two blocks are called? https://hastebin.com/tofececaga.rb
[20:16:26] baweaver: What's blocking you?
[20:16:28] gusrub: has joined #ruby
[20:16:31] SaschaVoid: has joined #ruby
[20:17:17] nicesignal: has joined #ruby
[20:17:19] baweaver: &block is how you pass a block (as an argument) or capture one (as a method param)
[20:17:32] baweaver: block.call is just invoking the block
[20:17:53] MichaelBurge: That's true, but when you wrap it inside of another do..end block it should be equivalent, right?
[20:17:56] 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
[20:18:12] baweaver: mrmax: Nokogiri
[20:18:27] baweaver: MichaelBurge: How so?
[20:18:33] olivier__: has joined #ruby
[20:18:33] hxegon: mrmax: https://github.com/sparklemotion/nokogiri
[20:18:37] tristanp: has joined #ruby
[20:19:04] baweaver: ACTION stares at coffee and starts suspecting decaf
[20:19:09] marlinc: has joined #ruby
[20:19:19] baweaver: It's basically like using that with map
[20:19:31] baweaver: do you _just_ want to pass the block, or do you want to do other things?
[20:19:42] baweaver: it's basically shorthand
[20:19:48] MichaelBurge: I'm going to wrap it in an exception-catching block and print the exception
[20:20:18] MichaelBurge: They're not equivalent, because my fixtures aren't initialized in the first example but are in the second
[20:20:47] MichaelBurge: I did 'p block.arity' and it shows 0
[20:20:47] mrmax: thanks - will check nokogiri
[20:20:54] MichaelBurge: So there aren't any arguments
[20:21:10] MichaelBurge: The block in question are also my unit tests, so I know they aren't using the arguments
[20:22:48] baweaver: what's the super method look like?
[20:23:21] MichaelBurge: That would be ActiveSupport::TestCase's test method. I'll go dig it up
[20:24:03] baweaver: RSpec does have options to handle exception raising tests
[20:24:12] brent__: has joined #ruby
[20:25:27] rkazak: has joined #ruby
[20:27:59] MichaelBurge: beweaver: Here it is: http://api.rubyonrails.org/classes/ActiveSupport/Testing/Declarative.html
[20:28:37] antgel: has joined #ruby
[20:29:22] baweaver: Something with define_me.....
[20:29:35] baweaver: module_eval or class_eval is being used somewhere
[20:29:35] ur5us: has joined #ruby
[20:29:55] baweaver: which means that it goes and does odd things to the binding context
[20:31:27] 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?
[20:32:10] baweaver: yeah, shenanigans
[20:32:32] MichaelBurge: Within the 'do' block, I can see that self is the child class, not the parent
[20:32:38] baweaver: so &block will keep the context
[20:32:44] baweaver: block.call in a new block won't
[20:32:50] n1299: has joined #ruby
[20:33:02] MichaelBurge: Okay. Is there a way to preserve the context when invoking it?
[20:33:30] baweaver: Honestly not entirely sure. You could try local variables but this gets dirty fast.
[20:33:53] baweaver: Hrm. Not sure I have a really good answer for this one
[20:35:15] matthewd: instance_exec
[20:35:23] MichaelBurge: self.instance_eval(&block) inside of the do..end seems to do the trick
[20:35:33] mdw: has joined #ruby
[20:35:47] baweaver: yeah, so many levels of meta down and I lose track of what goes where :/
[20:36:29] baweaver: ACTION wanders off for coffee
[20:41:04] gusrub: has joined #ruby
[20:44:09] ujjain: has joined #ruby
[20:44:10] ujjain: has joined #ruby
[20:44:19] ascarter: has joined #ruby
[20:45:39] muelleme: has joined #ruby
[20:47:57] whathappens: has left #ruby: ("Bless bless...")
[20:50:05] bkxd: has joined #ruby
[20:53:35] blackmesa: has joined #ruby
[20:57:51] haylon: has joined #ruby
[20:59:38] olivier__: has joined #ruby
[21:01:10] ur5us: has joined #ruby
[21:02:05] patarr: has joined #ruby
[21:05:21] milardovich: has joined #ruby
[21:05:36] jgt: has joined #ruby
[21:06:31] d5sx43: has joined #ruby
[21:06:33] milardovich: has joined #ruby
[21:08:52] olivier__: has joined #ruby
[21:08:58] patarr: has joined #ruby
[21:13:41] burgestrand: has joined #ruby
[21:13:59] raspado: has joined #ruby
[21:16:08] JeanCarloMachado: has joined #ruby
[21:16:13] JeanCarl1Machado: has joined #ruby
[21:17:32] majuk_: has joined #ruby
[21:19:04] dcluna: has joined #ruby
[21:19:26] jeffreylevesque: has joined #ruby
[21:19:37] romank: has joined #ruby
[21:19:48] patarr: has joined #ruby
[21:22:36] romank: has joined #ruby
[21:26:17] patarr: has joined #ruby
[21:26:47] Pumukel: has joined #ruby
[21:27:05] michael_mbp: havenwood: what's strange is docs for Tempfile do not go into such detail.
[21:35:52] bkxd: has joined #ruby
[21:36:46] gothicsouth: has joined #ruby
[21:38:26] ResidentBiscuit: has joined #ruby
[21:39:40] skweek: has joined #ruby
[21:42:50] patarr: has joined #ruby
[21:44:42] GodFather: has joined #ruby
[21:47:39] mattp_: has joined #ruby
[21:48:02] milardovich: has joined #ruby
[21:48:49] kobain: has joined #ruby
[21:49:11] kobain: has joined #ruby
[21:49:33] kobain: has joined #ruby
[21:49:51] t-recx: has joined #ruby
[21:51:14] 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.
[21:51:44] havenwood: michael_mbp: Fair to say it's not easy to find.
[21:52:14] MichaelBurge: has joined #ruby
[21:52:52] olivier__: has joined #ruby
[21:53:46] patarr: has joined #ruby
[21:54:45] jenrzzz: has joined #ruby
[21:54:45] jenrzzz: has joined #ruby
[21:59:20] zenspider: MichaelBurge: did you get things figured out? also, why are you adding logging to your unit tests?
[22:00:11] zenspider: curious wtf was going on... that seems way overly complex
[22:01:05] gothicsouth: has joined #ruby
[22:01:22] itarato: has joined #ruby
[22:01:57] 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.
[22:02:15] MichaelBurge: I could've probably overridden inspect to get the information I needed, but I didn't realize it until after
[22:02:22] cagomez: has joined #ruby
[22:03:30] zenspider: MichaelBurge: if you're using minitest, assert_raises returns the exception object so you can test anything extra that should be on it
[22:03:49] michael_mbp: havenwood: gotcha!
[22:03:59] zenspider: eg e = assert_raises { ...}; assert_equal 42, e.something
[22:04:08] MichaelBurge: zenspider: The exception was unexpected, so I wouldn't need an assert.
[22:04:27] MichaelBurge: Though, maybe you meant for debugging that one test you could add the assert
[22:05:14] zenspider: either way... if it is unexpected... yeah. I'd go ahead and define inspect on it, or use `pp` after capturing it
[22:05:42] mrconfused: has joined #ruby
[22:05:48] cahoots: has joined #ruby
[22:05:49] Pumukel: has joined #ruby
[22:06:41] Guest95673: has joined #ruby
[22:07:42] Guest95673: has left #ruby: ()
[22:10:20] 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.
[22:10:31] zenspider: Is this threading on windows being wonky?
[22:10:45] ozcanesen: has joined #ruby
[22:12:06] milardovich: has joined #ruby
[22:13:06] matthewd: zenspider: I think it (the original code) was an infinite loop via tail call recursion
[22:16:37] 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)
[22:16:59] mitt3ns: has joined #ruby
[22:17:23] zenspider: their claim was that the second thread doesn't even start because it gets stuck on the first one. It starts fine.
[22:17:37] banisterfiend: has joined #ruby
[22:18:21] zenspider: I did have to turn off the prints because it was obnoxious... but you could see both running fine
[22:19:44] JeanCarloMachado: has joined #ruby
[22:19:46] matthewd: Ah, yeah.. maybe just misreading the output. The second thread dies first for me, so the last screenful of output is all "1".
[22:20:10] JeanCarl1Machado: has joined #ruby
[22:20:15] zenspider: ACTION shrugs
[22:24:48] majuk: has joined #ruby
[22:25:31] majuk: So I'm on Linux and I'd like to install a recent version of ruby-dev without going through package management.
[22:25:57] mrconfused: has joined #ruby
[22:27:27] majuk: for realz
[22:28:35] volty: has joined #ruby
[22:30:06] patarr: has joined #ruby
[22:31:39] enterprisey: has joined #ruby
[22:33:31] jusa: has joined #ruby
[22:35:01] zachk: has joined #ruby
[22:35:05] zachk: has joined #ruby
[22:38:02] bruno-_: has joined #ruby
[22:41:50] gnufied: has joined #ruby
[22:49:14] hahuang65: has joined #ruby
[22:50:52] mrconfused: has joined #ruby
[22:51:11] jgt: has joined #ruby
[22:52:28] bkxd: has joined #ruby
[22:53:58] jane_booty_doe: has joined #ruby
[22:55:30] olivier__: has joined #ruby
[22:58:31] bilal: has joined #ruby
[22:59:42] mrconfused: has joined #ruby
[23:00:20] 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.
[23:00:58] cam27: Never knew they were linked like that
[23:01:39] majuk: 60% of most college degrees is vocabulary.
[23:01:54] majuk: Some are closer to 95%
[23:03:08] 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
[23:04:48] 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.
[23:06:46] charliesome: has joined #ruby
[23:07:54] 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)
[23:08:34] zenspider: grr.. "a CLASS method" ... my fingers aren't cooperating today
[23:08:39] milardovich: has joined #ruby
[23:08:46] nofxx: has joined #ruby
[23:13:08] 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
[23:13:08] cam27: method is that you send a message to the object that’s the class rather than to one of
[23:13:09] cam27: the class’s instances. The message most_expensive goes to the class Ticket, not to a
[23:13:10] cam27: particular ticket.
[23:14:34] istrasci: has joined #ruby
[23:15:15] cam27: So highest mustbe an instance of class? highest = Ticket.most_expensive(th,cc,fg)
[23:15:16] cam27: puts "The highest-priced ticket is the one for #{highest.venue}."
[23:15:42] olivier__: has joined #ruby
[23:16:51] 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?
[23:19:30] DLSteve: has joined #ruby
[23:25:09] redaudit: has joined #ruby
[23:27:51] itarato: has joined #ruby
[23:29:13] nicesignal: has joined #ruby
[23:29:30] jphase: has joined #ruby
[23:31:45] quiller: has joined #ruby
[23:33:10] cschneid_: has joined #ruby
[23:34:12] BSaboia: has joined #ruby
[23:36:06] boombox_: has joined #ruby
[23:40:08] raspado: has joined #ruby
[23:44:56] cagomez: has joined #ruby
[23:45:42] Fysicus: has joined #ruby
[23:46:26] KeyJoo: has joined #ruby
[23:49:10] snockerton: has joined #ruby
[23:52:45] AnoHito_: has joined #ruby
[23:56:13] alveric2: has joined #ruby
[23:59:14] ascarter: has joined #ruby
[23:59:30] ascarter_: has joined #ruby