« Back to channel list

#ruby - 01 November 2017

« Back 1 day Forward 1 day »
[00:00:00] apeiros: has joined #ruby
[00:00:14] Radar: I knew about [<regex>] but not [<regex>, <num>]
[00:01:16] FastJack: has joined #ruby
[00:02:08] RickHull: WTH, how is R the least disliked language? https://stackoverflow.blog/2017/10/31/disliked-programming-languages/
[00:02:15] RickHull: R is The Worst (tm)
[00:02:38] Radar: Stockholm Syndrome?
[00:02:55] Papierkorb: Perl is where it belongs
[00:03:00] stephh: has joined #ruby
[00:08:01] vtx: has joined #ruby
[00:08:39] bdonnahue: has joined #ruby
[00:09:04] bdonnahue: hey guys. im using rvm to install ruby but im seeing the following error:
[00:09:05] bdonnahue: ruby-2.1.0 - #making binaries executable..
[00:09:05] bdonnahue: curl: (60) Peer's Certificate has expired.
[00:09:10] bdonnahue: anyone know what to do?
[00:09:19] Ropeney: has joined #ruby
[00:09:40] RickHull: upgrade curl
[00:09:41] Papierkorb: 1) is your system clock correct? 2) Ruby2.1 is end of life'd
[00:09:46] RickHull: and why install 2.1.0?
[00:10:06] apeiros: has joined #ruby
[00:10:09] bdonnahue: redmine needs it afaik. double checking that
[00:11:40] RickHull: I doubt it. if anything in your infra depends on something EOL'd you should reconsider your infra
[00:11:54] vtx: hi guys, does anyone here have experience testing sinatra apps with rspec? i can test a simple /status endpoint with: https://gist.github.com/anonymous/10bd887c820269458a9859ff24df3725 but i don’t know how to test more complex endpoints. for example, say i have a /user endpoint that connects to an ldap service or something similar. how can i mock out calls to those services using expect/allow?
[00:12:12] weaksauce: has joined #ruby
[00:15:18] guacamole: has joined #ruby
[00:16:21] ElDoggo: has joined #ruby
[00:16:27] apeiros: has joined #ruby
[00:17:37] dviola: has joined #ruby
[00:22:09] ruby_: has joined #ruby
[00:22:42] csk157: has joined #ruby
[00:22:58] ruby_: has joined #ruby
[00:27:33] apeiros: has joined #ruby
[00:30:59] guardianx: has joined #ruby
[00:31:34] AndBobsYourUncle: has joined #ruby
[00:31:39] Jameser: has joined #ruby
[00:34:48] workmad3: has joined #ruby
[00:36:48] RickHull: i'm guessing that's a WebMock question
[00:37:27] RickHull: quick search gives me https://github.com/bblimke/webmock and https://robots.thoughtbot.com/how-to-stub-external-services-in-tests
[00:38:56] postmodern: has joined #ruby
[00:40:56] catphish: redis proxy all working now :)
[00:46:38] Technodrome: has joined #ruby
[00:46:58] ElDoggo: has joined #ruby
[00:51:04] TvL: has joined #ruby
[00:54:32] apeiros: has joined #ruby
[00:54:32] leah2: has joined #ruby
[00:58:02] guacamole: has joined #ruby
[01:01:15] eckhardt: has joined #ruby
[01:02:35] TvL: has joined #ruby
[01:04:00] RickHull: catphish: nice :)
[01:04:16] RickHull: https://gist.github.com/rickhull/ad6f9959d9a218f8240c4ef079c478bd
[01:04:36] RickHull: untested, I wrote it in the dang web editor
[01:06:25] ur5us: has joined #ruby
[01:06:45] mson: has joined #ruby
[01:06:53] nginxxx: has joined #ruby
[01:07:50] mgorbach: has joined #ruby
[01:07:53] nginxxx: Why is metasploit framework not made in python?
[01:08:16] nginxxx: i mean is it really better in ruby?
[01:08:27] RickHull: who wrote it?
[01:08:37] jphase: has joined #ruby
[01:09:10] Papierkorb: as ruby is obviously superior to python ... (lul)
[01:09:23] Papierkorb: nginxxx: https://github.com/rapid7/metasploit-framework/wiki/Why-Ruby%3F
[01:10:09] nginxxx: do you guys know more projects like ms in ruby?
[01:10:19] nginxxx: but in ruby
[01:11:01] apeiros: has joined #ruby
[01:11:10] benzrf: oh my god
[01:11:23] benzrf: so i modified the mac thing to pass the data in all at once and it errored
[01:11:40] benzrf: i poked a bit and it seems that update was returning the full data encrypted
[01:11:47] benzrf: and it expected only 16 bytes out
[01:11:56] benzrf: so. i. called update once. and. truncated to the last 16 bytes.
[01:12:05] benzrf: presto. instantly 100MB/s and my fan doesnt turn on
[01:12:38] RickHull: i'm not a fan of the openssl api and it's easy to misuse
[01:12:49] benzrf: but this is
[01:13:02] RickHull: it's possible you are not doing the mac check
[01:13:12] benzrf: this part isnt the check
[01:13:14] benzrf: it compares the result
[01:13:24] benzrf: so presumably this is producing the same result
[01:13:36] benzrf: here's my theory...
[01:13:48] benzrf: calling update all at once has to allocate a big string
[01:14:05] nginxxx: has joined #ruby
[01:14:12] benzrf: so maybe in C, it's better to do the loop, because you have to loop over the data anyway, and that way you dont need to keep allocating
[01:14:22] benzrf: and then whoever wrote this decided the same thing was true here.
[01:15:07] RickHull: what besides the mac check has to do with 16 bytes?
[01:15:30] benzrf: the function i altered was just the part that computed a mac
[01:16:18] RickHull: probably quicker to paste the diff or whatever
[01:16:45] benzrf: RickHull: https://gist.github.com/benzrf/cea67734c3ea4df0914ae1066f818680/revisions#diff-0abc4e14ebec1157f5747905ec22a461
[01:17:46] jenrzzz: has joined #ruby
[01:17:48] benzrf: via 19:29 <catphish> block = data + "\x0"*((16-data.bytesize%16)%16);
[01:18:03] benzrf: saved me the trouble of taking 20 seconds to figure out my fenceposts :>
[01:19:48] enterprisey: has joined #ruby
[01:20:22] RickHull: sweet, submit a PR with tests and comments, or at least file an issue
[01:20:49] RickHull: I don't quite follow it at a glance, or care particularly, but it looks reasonable :)
[01:20:50] nicesignal: has joined #ruby
[01:22:05] RickHull: i mean I get doing the padding, that's plenty sensible and avoids some dumb comparisons and conditionals
[01:22:26] jphase: has joined #ruby
[01:24:31] apeiros: has joined #ruby
[01:25:40] ElDoggo: has joined #ruby
[01:27:49] RickHull: OIC, it was churning through all the data 16 bytes at a time? anyways, I'd back away slowly from that gem
[01:30:17] cdg: has joined #ruby
[01:31:13] alfiemax: has joined #ruby
[01:31:34] nginxxx: what are the main channels here like anonops on anonymous irc
[01:31:43] nginxxx: list is soooooo long
[01:31:57] ElDoggo_: has joined #ruby
[01:32:46] RickHull: like social channels?
[01:32:49] benzrf: RickHull: it works pretty well apart from that though o:
[01:33:09] RickHull: help em fix it then :)\
[01:33:37] matthewd: I guess there's probably a #freenode ¯\_(ツ)_/¯
[01:34:12] RickHull: most channels here are organized around particular F/OSS projects
[01:34:23] nginxxx: thats what i searched, thx
[01:35:12] ElDoggo__: has joined #ruby
[01:36:53] apeiros: has joined #ruby
[01:37:13] cschneid_: has joined #ruby
[01:37:26] ElDoggo_: has joined #ruby
[01:40:53] RickHull: playing around with this https://gettalong.org/blog/2017/memory-conscious-programming-in-ruby.html
[01:41:45] harfangk: has joined #ruby
[01:44:29] ElDoggo__: has joined #ruby
[01:44:53] ElDoggo__: has joined #ruby
[01:45:21] jphase: has joined #ruby
[01:45:35] haraoka: has joined #ruby
[01:45:52] weaksauce: has joined #ruby
[01:46:08] fuzzyhorns: has joined #ruby
[01:46:24] fuzzyhorns: i'm looking at some library code and a bit confused, never seen this before
[01:46:26] fuzzyhorns: https://github.com/pvande/differ/blob/master/lib/differ.rb
[01:46:37] fuzzyhorns: old_sep, $; = $;, separator
[01:46:42] fuzzyhorns: multiple assignment i've seen before
[01:52:19] leah2: The default separator for String#split.
[01:52:38] apeiros: has joined #ruby
[01:54:29] fuzzyhorns: that seems so weird to me
[01:54:32] jphase: has joined #ruby
[01:54:37] fuzzyhorns: like $ is usually path and ; ends a line
[01:55:07] RickHull: because perl
[01:55:49] fuzzyhorns: $;.to_s => ","
[01:55:56] fuzzyhorns: good lord lol
[01:56:01] RickHull: http://ruby-doc.org/stdlib-2.4.2/libdoc/English/rdoc/English.html
[01:56:16] RickHull: mfer do you speak it?! ;)
[01:57:38] fuzzyhorns: lolll well, TIL
[01:58:05] benzrf: whyyy does ruby have global variables
[01:58:05] orbyt_: has joined #ruby
[01:58:17] benzrf: WHYYYYYYYYYYYYY does ruby USE GLOBAL VARIABLES TO CONFIGURE DEFAULTS
[01:59:01] RickHull: because perl
[01:59:57] RickHull: but let's talk about smalltalk and lisp shall we?
[02:00:30] cdg: has joined #ruby
[02:01:40] gizmore: has joined #ruby
[02:04:17] ek926m: has joined #ruby
[02:06:43] apeiros: has joined #ruby
[02:06:54] justwentviral: has joined #ruby
[02:08:13] jphase: has joined #ruby
[02:11:22] d^sh: has joined #ruby
[02:12:52] jrafanie: has joined #ruby
[02:13:22] benzrf: i know because perl
[02:13:28] benzrf: but that's not an excuse
[02:13:50] benzrf: like. just because perl does it. matz still had to look at it and think "yes. that is a good idea. i will put this into my language"
[02:14:20] matthewd: Defaults are pretty much global by default, no?
[02:15:20] benzrf: sorry, not precisely "defaults", i mean like "defaults" in the sense of default behavior of things like #split in the absence of specific args
[02:15:59] benzrf: er, and my objection was less to the use of global variables as opposed to something else, and more the ability to do that at all
[02:16:10] justwentviral: why would i use ruby/rails to make a high-traffic website when it has a reputation of being slow at large scale? i feel like one would be making a bit of a mistake. i ask because, i'm hoping i'm under some misconception or something, as making an mvp in and finding additional resources (learning tools, manpower, etc.) in ruby seems infinitely easier than with, say, haskell or another esoteric but arguably more better-suited langua
[02:16:15] rsa3157: has joined #ruby
[02:16:23] benzrf: if you _really_ want that to be possible, at _least_ don't make it dynamically changable at runtime! good god
[02:17:00] PaulCapestany: has joined #ruby
[02:18:19] matthewd: justwentviral: The obvious answer would be that you're not making a high-traffic website
[02:19:53] matthewd: justwentviral: The second would be that "high", "slow", and "large" are all relative
[02:21:19] justwentviral: so i shouldn't use ruby then for what i INTEND to be a high-traffic website, if i want to save myself some headache in the future then
[02:22:24] matthewd: If you prefer headache now, that's up to you ¯\_(ツ)_/¯
[02:23:30] justwentviral: really does seem like a pick-your-poison situation, i suppose :/
[02:23:50] csk157: has joined #ruby
[02:24:22] mtkd: has joined #ruby
[02:25:00] matthewd: Personally, I prefer to solve for problems I'm having now -- ease of development, for example -- over problems I might have in future, like unquantifiable "high-traffic"
[02:25:34] matthewd: There are plenty of Very Not Small things running happily either entirely or substantially on Rails
[02:25:39] apeiros: has joined #ruby
[02:26:05] RickHull: justwentviral: a website needs hardly any processing power. a webapp can be a tarpit of resources
[02:26:09] RickHull: but it doesn't have to be
[02:26:48] RickHull: just use node and push the inefficiency to battery-powered phones, I say
[02:27:50] RickHull: but for real, it's easy to make efficient websites, and server-based webapps
[02:28:55] RickHull: it's also easy to hack your way through your first rails tutorial and try to stuff everything into ActiveRecord
[02:29:25] RickHull: maybe it works better now, I haven't used in anger in about 5 years
[02:31:08] uZiel: has joined #ruby
[02:31:10] veeti: has joined #ruby
[02:31:32] bdonnahue: hey guys, im seeing the following: mkmf.rb can't find header files for ruby
[02:31:42] bdonnahue: i installed ruby with rvm
[02:31:46] bdonnahue: any idea what im misisng?
[02:31:55] RickHull: not to knock AR -- it does what it says on the tin -- but it can be an easy but wrong place to stuff important logic
[02:32:21] RickHull: bdonnahue: what linux distro? you probably need the ruby-dev package
[02:32:39] lobloblobster: has joined #ruby
[02:32:49] naitian: has left #ruby: ("WeeChat 1.9.1")
[02:32:50] RickHull: try installing ruby-devel
[02:33:17] RickHull: what is driving mkmf.rb ?
[02:33:25] bdonnahue: RickHull, im new to ruby. I am worried that the devel will not match the version i installed with rvm
[02:33:28] RickHull: a gem with a C extension?
[02:33:47] RickHull: what step are you trying to accomplish that bombs out with mkmf.rb ?
[02:34:01] bdonnahue: RickHull, speaking french right now haha im very new to ruby
[02:34:05] bdonnahue: let me check
[02:34:23] bdonnahue: An error occurred while installing json (1.8.6), and Bundler cannot continue.
[02:34:26] bdonnahue: does that help?
[02:34:32] RickHull: if you are following a tutorial, paste a link
[02:34:47] apeiros: has joined #ruby
[02:35:03] RickHull: what ruby version?
[02:35:17] workmad3: has joined #ruby
[02:35:49] jphase: has joined #ruby
[02:36:14] bdonnahue: https://pastebin.com/pusrX8DS
[02:36:15] ruby[bot]: bdonnahue: as I told you already, please use https://gist.github.com
[02:36:39] bdonnahue: ur a jerk ruby bot
[02:37:23] bdonnahue: https://gist.github.com/bdonnahue/532f5490f3028836ad85ff9c400ab2c7
[02:37:39] RickHull: ha, no worries ;)
[02:37:59] RickHull: ok, so yeah, the json gem needs to know about ruby's C underpinnings
[02:38:14] RickHull: i haven't used rvm in a while
[02:38:26] lacour: has joined #ruby
[02:38:30] RickHull: but something in rubygems / C extension / mkmf / yadayada should be able to find the ruby header files
[02:38:34] RickHull: if rvm installed them
[02:38:49] RickHull: maybe when you do rvm install ruby-2.1 you need to ask for header / dev files?
[02:38:54] bdonnahue: ahh maybe i need to install the c header files with yum?
[02:39:06] RickHull: well yeah, if you weren't trying to use rvm
[02:39:20] RickHull: though the header files themselves could possibly work anyway
[02:39:26] RickHull: i doubt they churn much
[02:39:39] RickHull: i mean the yum ruby-devel package. it could work maybe
[02:39:57] RickHull: but if you are using rvm, then you probably want rvm to manage the headers and it should work
[02:40:21] RickHull: you can try #rvm too
[02:41:15] hutch34: has joined #ruby
[02:41:22] jenrzzz: has joined #ruby
[02:41:22] jenrzzz: has joined #ruby
[02:43:36] RickHull: bdonnahue: hm, looks like #rvm is pretty dead here; since they say to leave your email
[02:44:56] jphase: has joined #ruby
[02:45:57] ElDoggo: has joined #ruby
[02:46:53] apeiros: has joined #ruby
[02:48:27] lobloblobster: has joined #ruby
[02:53:18] iMadper: has joined #ruby
[02:54:16] banisterfiend: has joined #ruby
[02:57:08] apeiros: has joined #ruby
[02:58:29] banisterfiend: has joined #ruby
[02:59:28] bronson_: has joined #ruby
[02:59:40] gizmore|2: has joined #ruby
[03:00:09] cadillac_: has joined #ruby
[03:04:48] harfangk: has joined #ruby
[03:04:53] sspreitz: has joined #ruby
[03:05:38] code_zombie: has joined #ruby
[03:09:55] zautomata: has joined #ruby
[03:12:28] jphase: has joined #ruby
[03:16:01] harfangk_: has joined #ruby
[03:17:16] apeiros: has joined #ruby
[03:25:34] apeiros: has joined #ruby
[03:26:16] jphase: has joined #ruby
[03:26:51] alex``: has joined #ruby
[03:30:15] zautomata: has joined #ruby
[03:32:51] bruce_lee: has joined #ruby
[03:32:51] bruce_lee: has joined #ruby
[03:33:30] mim1k: has joined #ruby
[03:35:12] kapil___: has joined #ruby
[03:35:24] jphase: has joined #ruby
[03:37:13] cschneid_: has joined #ruby
[03:41:59] hutch34: has joined #ruby
[03:46:31] ElDoggo: has joined #ruby
[03:48:12] agent_white: has joined #ruby
[03:49:09] jphase: has joined #ruby
[03:49:51] ElDoggo_: has joined #ruby
[03:51:20] ElDoggo: has joined #ruby
[03:52:50] ElDoggo__: has joined #ruby
[03:53:46] cdg: has joined #ruby
[03:54:22] ElDoggo__: has joined #ruby
[03:55:51] ElDoggo: has joined #ruby
[03:58:22] ElDoggo_: has joined #ruby
[03:59:50] ElDoggo__: has joined #ruby
[04:04:51] ElDoggo_: has joined #ruby
[04:06:59] ElDoggo__: has joined #ruby
[04:08:21] ElDoggo: has joined #ruby
[04:11:24] ElDoggo_: has joined #ruby
[04:13:53] ElDoggo: has joined #ruby
[04:18:21] ElDoggo: has joined #ruby
[04:18:58] jenrzzz: has joined #ruby
[04:18:58] jenrzzz: has joined #ruby
[04:19:48] bronson: has joined #ruby
[04:21:18] jphase: has joined #ruby
[04:23:25] ElDoggo: has joined #ruby
[04:24:11] agent_white: has joined #ruby
[04:26:54] ElDoggo_: has joined #ruby
[04:29:55] ElDoggo: has joined #ruby
[04:31:21] apeiros: has joined #ruby
[04:31:29] ElDoggo__: has joined #ruby
[04:33:27] ElDoggo_: has joined #ruby
[04:35:56] workmad3: has joined #ruby
[04:35:59] ElDoggo: has joined #ruby
[04:37:27] ElDoggo__: has joined #ruby
[04:39:25] ElDoggo_: has joined #ruby
[04:42:26] ElDoggo__: has joined #ruby
[04:44:15] jphase: has joined #ruby
[04:44:57] ElDoggo_: has joined #ruby
[04:46:24] apeiros: has joined #ruby
[04:46:30] ElDoggo: has joined #ruby
[04:48:48] gix: has joined #ruby
[04:51:00] ElDoggo_: has joined #ruby
[04:52:09] claw: has joined #ruby
[04:52:25] jud: has joined #ruby
[04:53:25] jphase: has joined #ruby
[04:58:06] hutch34: has joined #ruby
[04:58:44] govg: has joined #ruby
[05:02:33] jphase: has joined #ruby
[05:03:04] biox-: has joined #ruby
[05:11:34] apeiros: has joined #ruby
[05:12:18] guardianx: has joined #ruby
[05:15:02] uZiel: has joined #ruby
[05:18:50] xall: has joined #ruby
[05:24:19] uZiel: has joined #ruby
[05:25:53] jphase: has joined #ruby
[05:26:10] csk157: has joined #ruby
[05:28:20] LocaMocha: has joined #ruby
[05:29:19] Freshnuts: has joined #ruby
[05:33:57] mim1k: has joined #ruby
[05:35:25] d5sx43: has joined #ruby
[05:37:53] anisha: has joined #ruby
[05:39:38] aupadhye: has joined #ruby
[05:40:47] k3rn31: has joined #ruby
[05:41:01] Technodrome: has joined #ruby
[05:42:25] LocaMocha: has joined #ruby
[05:51:26] LocaMocha: has joined #ruby
[05:59:10] hutch34: has joined #ruby
[06:07:59] guardianx: has joined #ruby
[06:12:43] guardianxx: has joined #ruby
[06:12:43] mim1k: has joined #ruby
[06:16:01] pb122: has joined #ruby
[06:16:23] armyriad: has joined #ruby
[06:21:08] jenrzzz: has joined #ruby
[06:21:08] jenrzzz: has joined #ruby
[06:25:43] ElDoggo: has joined #ruby
[06:29:15] ElDoggo_: has joined #ruby
[06:32:18] ElDoggo__: has joined #ruby
[06:32:23] armyriad: has joined #ruby
[06:34:19] ElDoggo_: has joined #ruby
[06:35:21] apeiros: has joined #ruby
[06:35:32] jenrzzz: has joined #ruby
[06:35:32] jenrzzz: has joined #ruby
[06:35:47] quobo: has joined #ruby
[06:35:48] ElDoggo: has joined #ruby
[06:36:45] workmad3: has joined #ruby
[06:37:19] ElDoggo__: has joined #ruby
[06:39:45] ElDoggo_: has joined #ruby
[06:44:18] hays_: has joined #ruby
[06:44:37] apeiros: has joined #ruby
[06:44:44] hays_: is there a ruby equivalent of entrypoints https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/
[06:44:54] Emmanuel_Chanel: has joined #ruby
[06:44:55] hays_: basically looking for how to package a CLI tool as a gem
[06:47:10] matthewd: hays_: I'm not sure what that does.. but see e.g. https://github.com/rails/rails/blob/master/railties/exe/rails
[06:47:39] matthewd: + https://github.com/rails/rails/blob/master/railties/railties.gemspec#L23-L24
[06:50:25] matthewd: Documented here: http://guides.rubygems.org/make-your-own-gem/#adding-an-executable
[06:53:30] hays_: yep that looks like the analog
[06:56:38] hays_: matthewd: is there a way to 'run' the gem without installing it? for more rapid testing?
[06:57:07] apeiros: has joined #ruby
[06:58:21] imode: has joined #ruby
[06:59:29] hays_: matthewd: the shebang thing is not particularly portable to say Windows..
[06:59:51] hutch34: has joined #ruby
[07:00:30] dinoangelov: has joined #ruby
[07:01:56] matthewd: That rails command is executable in place
[07:02:22] matthewd: It sets up the load path ($:) manually, but I think a modern approach would just rely on bundler to do that
[07:02:46] matthewd: So you'd do `bundle exec ./exe/mycmd`
[07:03:04] matthewd: exe/rails, the example I linked
[07:03:36] hays_: s.executables << 'hola'
[07:03:42] matthewd: As for Windows... tbh it's been many years since I've touched one, so don't remember *how*, but something makes it work ¯\_(ツ)_/¯
[07:03:58] hays_: it does it by file extension
[07:04:21] hays_: so i guess portability is achieved if you name your executables .rb
[07:04:22] matthewd: I mean something makes it so that `gem install rails` + `rails` works
[07:05:06] matthewd: I gave you three links -- the docs, and two halves of how the `rails` command works in Rails as a real-world example
[07:05:33] matthewd: But the guide also has an example of running it in place: `ruby -Ilib ./bin/hola`
[07:08:51] hays_: maybe there is some windows magic. i'll have to fire up my VM and see
[07:10:06] matthewd: I want to say rubygems creates a foo.bat maybe?
[07:10:47] hays_: that sounds just ugly enough to be right
[07:10:57] hays_: god i hate windows
[07:11:33] hays_: my company is trying to pry the macbooks out of developers' hands
[07:11:35] matthewd: Yup: https://github.com/rubygems/rubygems/blob/dfc9c72a91b14a5d630fc141cf30312da3bf2ba7/lib/rubygems/installer.rb#L452
[07:13:00] reber: has joined #ruby
[07:16:10] hays_: ok with all that bookmarked im going to bed. 3am in home time zone
[07:19:11] aufi: has joined #ruby
[07:25:09] Dreamer3: has joined #ruby
[07:36:50] Technodrome: has joined #ruby
[07:40:23] TomyWork: has joined #ruby
[07:40:59] alex``: has joined #ruby
[07:47:38] conta: has joined #ruby
[07:56:28] hxegon: has joined #ruby
[07:56:50] hxegon: has joined #ruby
[07:58:56] TinkerTyper: has joined #ruby
[08:00:40] hutch34: has joined #ruby
[08:01:04] burgestrand: has joined #ruby
[08:09:09] csk157: has joined #ruby
[08:17:18] mn3m: has joined #ruby
[08:17:31] uZiel: has joined #ruby
[08:19:25] claudiuinberlin: has joined #ruby
[08:23:26] FahmeF_: has joined #ruby
[08:23:36] mark_66: has joined #ruby
[08:23:36] nertzy: has joined #ruby
[08:43:15] ams__: has joined #ruby
[08:44:26] cabotto: has joined #ruby
[08:44:43] ltem: has joined #ruby
[08:45:50] uZiel: has joined #ruby
[08:47:54] paranoicsan: has joined #ruby
[08:57:03] vondruch: has joined #ruby
[09:00:25] Dreamer3: has joined #ruby
[09:00:33] vondruch: has joined #ruby
[09:01:23] hutch34: has joined #ruby
[09:02:07] VladGh_: has joined #ruby
[09:06:40] bigkevmcd: has joined #ruby
[09:14:12] sppp: Hello,I am currently at the planning phase of my project and would like to study the different options i have to start building my website and its backend.
[09:14:19] sppp: I was thinking if there is an opensource framework i can build upon like wordpress or others that would allow me to create a IT request/response ticketing solution. Mainly customers can login, submit their requests, IT professionals can login takethe request, submit the solution and get paid. The system needs to be flexible where i can change parameters for the request screen, make the request flow from one status to another etc.
[09:14:24] sppp: Is there an existing framework i can build on instead of coding from scratch the whole engine? Your opinion is really valuable to me thank you
[09:15:49] dminuoso: _ppp: Jira Service Desk is an example. Other alternatives exist.
[09:16:14] apeiros: redmine is a rails based ticket system
[09:16:19] apeiros: we use and extended it at work
[09:17:01] apeiros: Since I have not worked on extending it myself, I can't give any account on how good the interfaces are
[09:20:49] dminuoso: _ppp: ?cross
[09:20:54] dminuoso: ?cross _ppp
[09:20:54] ruby[bot]: dminuoso: I don't know anything about cross
[09:20:57] dminuoso: ?crosspost _ppp
[09:20:58] ruby[bot]: _ppp: Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
[09:21:43] apeiros: oh, reminds me that I'm not in #rubyonrails anymore
[09:21:46] Valkyrie_: has joined #ruby
[09:22:47] dminuoso: apeiros: This was in #javascript.
[09:24:53] bruno-: has joined #ruby
[09:25:08] Tempesta: has joined #ruby
[09:26:56] xcesariox: has joined #ruby
[09:27:11] bauruine: has joined #ruby
[09:27:11] Beams: has joined #ruby
[09:29:25] workmad3: has joined #ruby
[09:32:24] vondruch: has joined #ruby
[09:37:07] dionysus69: has joined #ruby
[09:37:33] uZiel_: has joined #ruby
[09:38:52] anisha_: has joined #ruby
[09:47:29] vtx: has joined #ruby
[09:50:01] dminuoso: https://eval.in/890645
[09:50:11] dminuoso: Err, what am I doing wrong here?
[09:51:42] dminuoso: https://eval.in/890646 this works
[09:51:45] dminuoso: What the heck is going on?
[09:51:53] dminuoso: Is this a bug?
[09:52:18] Hexafox[I]: has joined #ruby
[09:52:31] apeiros: Module.new do <-- that block goes to prepend
[09:52:52] dminuoso: Not a year goes by where I get tripped up.
[09:52:52] apeiros: precedence. it matters. :-p
[09:53:20] apeiros: I do wish methods which don't take a block raised
[09:53:35] apeiros: it wouldn't solve the problem but some cases would be more obvious
[09:53:46] lxsameer: has joined #ruby
[09:54:16] stamina: has joined #ruby
[09:54:58] dminuoso: apeiros: Look at this gross hack: https://gist.github.com/dminuoso/4f2454e6e29c7205d8bdb387e7e8a883
[09:55:35] dminuoso: I really do need to write a paginator for kaminari in pure cells. :(
[09:56:07] anisha_: has joined #ruby
[09:57:49] Tempesta: has joined #ruby
[09:58:17] milardovich: has joined #ruby
[09:58:41] Sylvia: has joined #ruby
[09:58:47] jaruga: has joined #ruby
[09:58:50] jottr: has joined #ruby
[10:00:07] apeiros: dminuoso: I'll not pretend to understand what you're doing there ;-)
[10:00:21] apeiros: kaminari is the successor to will_paginate?
[10:01:08] dminuoso: It's an alternative, but yeah.
[10:01:27] dminuoso: apeiros: Part of the problem is that all these rails things follow that "throw everything into helpers" conventions.
[10:01:45] apeiros: well, got my holidays, so I'll finally continue on my project I had to abandon 2y ago. a syncing table widget is part of it :)
[10:01:49] dminuoso: And trailblazers doesn't do that, so basically every helper is opt-in. This basically means a lot of things break.
[10:02:01] dminuoso: Oh that secret project you told me about without telling me anything?
[10:02:29] apeiros: I hope I'll be able to tell about parts of it after these holidays
[10:05:34] banisterfiend: has joined #ruby
[10:07:04] mim1k: has joined #ruby
[10:13:03] argoneus: as part of a homework I wrote some code that works, but I have no clue why
[10:13:59] argoneus: I have a module, inside it a function called "sum", and its only statement is 'reduce(:+)', this module is than included in a class that also includes enumerable, and for some reason calling 'sum' on this gives the desired result
[10:14:17] argoneus: what exactly does it mean if I just have 'reduce(:+)'? I can't find any doc on this
[10:14:51] argoneus: all I see is that reduce is a method of Enumerable, but inside this other module I'm writing, I don't include Enumerable
[10:16:17] argoneus: and what does that even return
[10:17:31] bruno-: has joined #ruby
[10:17:34] hutch34: has joined #ruby
[10:17:50] mikecmpbll: has joined #ruby
[10:20:54] bruno-: has joined #ruby
[10:24:10] banisterfiend: anyone here famiiliar with net/http and ssl requests?
[10:26:00] wunz: has joined #ruby
[10:30:40] hutch34: has joined #ruby
[10:31:06] cadillac_: has joined #ruby
[10:32:22] sneep: ACTION met Matz today \o/
[10:33:35] elomatreb: argoneus: Does something you extend include Enumerable? Check with YourModule.ancestors
[10:34:52] ldnunes: has joined #ruby
[10:37:08] apeiros: argoneus: since you include your module into a class which also includes Enumerable, that's sufficient
[10:37:36] apeiros: your module's instance methods, when called on an instance of the including class, can access all instance methods of that class. that includes all methods gained from including other modules.
[10:38:13] dminuoso: argoneus: reduce(:+) is just a shortcut for reduce(&:+)
[10:38:52] apeiros: and as such, the docs you look for are indeed Enumerable#reduce
[10:38:56] apeiros: &ri Enumerable#reduce argoneus
[10:38:56] `derpy: argoneus: http://ruby-doc.org/core-2.4.1/Enumerable.html#method-i-reduce
[10:39:02] Pisuke: has joined #ruby
[10:39:32] dminuoso: Or actually not exactly.
[10:40:10] aruns_: has joined #ruby
[10:41:22] dminuoso: apeiros: see, if ruby had autocurrying this would be so simple. reduce((+)) :(
[10:41:23] ElDoggo: has joined #ruby
[10:41:30] CrazyEddy: has joined #ruby
[10:41:32] banisterfiend: apeiros sup homie you familiar with ssl and net/http ?
[10:41:52] banisterfiend: apeiros i need to hit a server using https and i need to verify the identify of the server, any ideas? :D
[10:41:55] apeiros: banisterfiend: not really. I have code which performs https calls using net/http, but that's about it
[10:42:03] hfp_work: has joined #ruby
[10:42:09] _sfiguser: has joined #ruby
[10:43:55] ElDoggo_: has joined #ruby
[10:43:58] tomphp: has joined #ruby
[10:45:56] apeiros: verify the server's identity? I guess you'd have to check the cert it returns?
[10:46:40] PaulCape_: has joined #ruby
[10:47:44] banisterfiend: apeiros yeah, i was told that ruby does that automatically as it bundles an up to date ca store with the common CAs in it
[10:47:50] banisterfiend: but i wanted to know for sure
[10:48:13] apeiros: I remember rvm doing that, but I don't remember ruby itself doing it
[10:48:23] ElDoggo: has joined #ruby
[10:48:35] apeiros: and I think you can tell net/http where to look for ca's, but I don't know the relevant methods by heart
[10:48:59] apeiros: we usually had to disable cert checking because our infra guys couldn't be arsed to get proper certs on internal servers :(
[10:50:13] elomatreb: Reading is hard
[11:01:36] rburton-: has joined #ruby
[11:02:30] rburton-: is there a way to see the checks and choices made by eg ext/dbm when it builds? want to verify what db backend it ends up picking.
[11:06:06] InfinityFye: has joined #ruby
[11:10:47] csk157: has joined #ruby
[11:11:06] milardovich: has joined #ruby
[11:17:20] ElDoggo: has joined #ruby
[11:19:16] milardovich: has joined #ruby
[11:21:25] johnDoe1122: has joined #ruby
[11:25:56] apparition: has joined #ruby
[11:27:34] guardianxx: has joined #ruby
[11:27:39] sparrow_mango: has joined #ruby
[11:29:46] old1101: has joined #ruby
[11:30:55] old1101: hello, the best practice is to always install the gems in vendor/ on bundler? (even when deployment for isolation)
[11:34:47] old1101: it seems to me that vendor/bundle should always be the default (ruby newbie)
[11:35:48] elomatreb: Usually you don't want that, if you have multiple projects you will needlessly duplicate the gem files. The default bundler action is to store them in a shared directory, and get the project to use the right one at runtime
[11:36:38] old1101: but if project A uses gem-x-1.2 and project B uses gem-x.1.5
[11:36:45] old1101: it seems nice to have it always scoped, no?
[11:37:15] old1101: or `gem` handles it?
[11:37:27] elomatreb: Bundler does that at runtime, if your project has a gemfile it will use the one specified in it, even if there are multiple versions installed on the system
[11:38:05] old1101: so I can have two global versions of the same gem?
[11:38:18] old1101: different*
[11:48:26] csk157: has joined #ruby
[11:56:08] leah2: has joined #ruby
[11:57:51] argoneus: so whether reduce() exists or not is determined in the class that incldues the module
[11:57:54] argoneus: not in the module itself
[12:00:30] elomatreb: Calling a method without a receiver is equivalent to calling it on self, so yes
[12:04:28] pierrearseufrasi: has joined #ruby
[12:07:16] aclark: has joined #ruby
[12:08:01] synthroid: has joined #ruby
[12:10:10] workmad3: has joined #ruby
[12:14:24] ElDoggo: has joined #ruby
[12:15:05] mson: has joined #ruby
[12:17:11] ek926m: has joined #ruby
[12:18:20] ElDoggo: has joined #ruby
[12:18:40] Stan: has joined #ruby
[12:24:00] milardovich: has joined #ruby
[12:25:41] ledestin: has joined #ruby
[12:28:16] alex``: has joined #ruby
[12:28:43] n13z: has joined #ruby
[12:28:59] claudiuinberlin: has joined #ruby
[12:33:08] rburton-: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[12:36:28] milardov_: has joined #ruby
[12:36:52] Ropeney: has joined #ruby
[12:46:10] milardovich: has joined #ruby
[12:53:20] cabotto: has joined #ruby
[12:53:36] bruno-: has joined #ruby
[12:54:49] burgestrand: has joined #ruby
[12:55:55] Psybur: has joined #ruby
[12:57:42] biberu: has joined #ruby
[12:59:05] vondruch_: has joined #ruby
[13:00:29] sagax: has joined #ruby
[13:01:03] jphase: has joined #ruby
[13:02:45] cabotto: has joined #ruby
[13:05:34] cdg: has joined #ruby
[13:06:15] charliesome: has joined #ruby
[13:06:38] shinnya: has joined #ruby
[13:06:45] Tempesta: has joined #ruby
[13:10:30] cdg_: has joined #ruby
[13:12:29] csk157_1: has joined #ruby
[13:15:02] pierrearseufrasi: has left #ruby: ("Sair")
[13:15:04] jphase: has joined #ruby
[13:15:16] ramakanta: has joined #ruby
[13:16:00] sepp2k: has joined #ruby
[13:18:03] xcesariox: has joined #ruby
[13:19:46] burgestrand: has joined #ruby
[13:25:10] old1101: how can I run a ruby gem without gemspec file?
[13:25:20] ElDoggo_: has joined #ruby
[13:25:36] old1101: "ruby gem" = I'm using just bundle
[13:26:18] old1101: I would like to run lib/my_app.rb
[13:26:50] GodFather: has joined #ruby
[13:26:55] old1101: rspec puts my lib/ on load_path e.g.
[13:27:40] tvw: has joined #ruby
[13:27:56] Tempesta: has joined #ruby
[13:29:41] GodFather: has joined #ruby
[13:32:50] minimalism: has joined #ruby
[13:37:21] darkmorph: has joined #ruby
[13:38:54] burgestrand: has joined #ruby
[13:41:02] DLSteve: has joined #ruby
[13:41:29] old1101: seriously, how can I run my code (lib/app.rb) with bundler context? (files `lib/ Gemfile Gemfile.lock`)
[13:42:06] Papierkorb: bundle exec lib/foo.rb
[13:43:11] old1101: god lord, I was using `bundle exec ruby`
[13:45:16] dinfuehr: has joined #ruby
[13:48:20] mjolnird: has joined #ruby
[13:49:49] imperator: has joined #ruby
[13:53:28] Rapture: has joined #ruby
[13:54:12] old1101: has left #ruby: ("Leaving")
[13:55:53] jottr: has joined #ruby
[13:58:30] mim1k: has joined #ruby
[13:59:20] tcopeland: has joined #ruby
[13:59:29] john__: has joined #ruby
[14:04:49] brw: has joined #ruby
[14:09:05] aswen: has joined #ruby
[14:09:14] quobo: has joined #ruby
[14:10:35] jrafanie: has joined #ruby
[14:12:25] matti: has joined #ruby
[14:16:39] cabotto: has joined #ruby
[14:18:05] chouhoulis: has joined #ruby
[14:23:05] matti: has joined #ruby
[14:26:46] vondruch_: has joined #ruby
[14:29:13] troys: has joined #ruby
[14:29:41] jrafanie_: has joined #ruby
[14:30:18] nowhere_man: has joined #ruby
[14:31:40] cschneid_: has joined #ruby
[14:33:17] bruno-: has joined #ruby
[14:34:54] hhffppff: has joined #ruby
[14:35:38] ek926m: has joined #ruby
[14:36:45] claudiuinberlin: has joined #ruby
[14:39:39] veeti: has joined #ruby
[14:41:07] anisha: has joined #ruby
[14:45:29] charliesome_: has joined #ruby
[14:47:00] milardovich: has joined #ruby
[14:50:00] solocshaw: has joined #ruby
[14:52:59] lasenna[m]: has joined #ruby
[14:53:08] kua[m]: has joined #ruby
[14:53:56] cgfbee: has joined #ruby
[14:54:21] csk157_1: has joined #ruby
[14:54:27] KevinMGranger: has joined #ruby
[15:00:15] charliesome: has joined #ruby
[15:04:15] polishdub: has joined #ruby
[15:04:48] dextrey: has joined #ruby
[15:06:15] happyface: has joined #ruby
[15:09:11] bronson: has joined #ruby
[15:10:28] cschneid_: has joined #ruby
[15:11:27] guacamole: has joined #ruby
[15:14:56] ElDoggo: has joined #ruby
[15:15:05] charliesome_: has joined #ruby
[15:15:30] ruby[bot]: -bbb $a:jdawgaz jdawgaz!*@*$#ruby-fix-your-connection *!*@ip70-176-27-239.ph.ph.cox.net$#ruby-fix-your-connection
[15:15:50] iamarun: has joined #ruby
[15:16:11] guacamole: has joined #ruby
[15:16:13] veeti: has joined #ruby
[15:16:30] ruby[bot]: -bb jdawgaz!*@* *!*@ip70-176-27-239.ph.ph.cox.net
[15:16:51] nikhgupta1: has joined #ruby
[15:20:38] ElDoggo: has joined #ruby
[15:22:15] jrafanie: has joined #ruby
[15:23:20] nikhgupta1: has joined #ruby
[15:24:04] lobloblobster: has joined #ruby
[15:24:54] claudiuinberlin: has joined #ruby
[15:25:51] guacamole: has joined #ruby
[15:27:16] safetypin: has joined #ruby
[15:27:58] charliesome: has joined #ruby
[15:33:20] cagomez: has joined #ruby
[15:34:47] PaulCapestany: has joined #ruby
[15:35:55] nikhgupta: has joined #ruby
[15:38:43] safetypin: has joined #ruby
[15:39:44] kculpis: has joined #ruby
[15:43:17] nikhgupta1: has joined #ruby
[15:43:28] charliesome_: has joined #ruby
[15:47:39] Junaos: has joined #ruby
[15:51:17] bronson_: has joined #ruby
[15:51:52] solocshaw: has joined #ruby
[15:54:39] nikhgupta: has joined #ruby
[15:56:02] RougeR: has joined #ruby
[15:57:27] lacour: has joined #ruby
[15:58:05] charliesome: has joined #ruby
[16:00:53] cdg: has joined #ruby
[16:04:54] nikhgupta: has joined #ruby
[16:05:11] solocshaw1: has joined #ruby
[16:05:55] cdg_: has joined #ruby
[16:12:15] dionysus69: has joined #ruby
[16:13:20] raynold: has joined #ruby
[16:16:48] vipaca: has joined #ruby
[16:16:52] charliesome_: has joined #ruby
[16:17:23] orbyt_: has joined #ruby
[16:22:40] Dreamer3: has joined #ruby
[16:23:00] ldnunes: has joined #ruby
[16:23:08] code_zombie: has joined #ruby
[16:26:33] Guest77: has joined #ruby
[16:27:02] dragon14: anyone have time to help me debug a ruby-install issue? I'm trying to install ruby v2.3.4 but getting the following error: /usr/include/sys/syslog.h:227:124: error: expected ',' or ';' before '__asm' on Mac OS 10.13.1
[16:30:04] raynold: ahh it's a wonderful day
[16:30:46] dragon14: mostly cloudy here with a high chance of ruby install errors lol
[16:31:19] havenwood: dragon14: It looks like there's a gcc bug: https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg544669.html
[16:32:06] dragon14: @havenwood hmm I had to install gcc6 just to get the process started
[16:32:22] ozcanesen: has joined #ruby
[16:33:10] havenwood: dragon14: Usually folk on macOS install "command line tools" including clang with: xcode-select --install
[16:33:28] dragon14: havenwood: yeah I have xcode command line tools installed
[16:33:36] havenwood: dragon14: See: https://github.com/rvm/rvm/issues/4200
[16:35:59] havenwood: dragon14: does it work if you set CC=clang but you want to use gcc?
[16:37:17] DTZUZO: has joined #ruby
[16:37:47] rippa: has joined #ruby
[16:38:22] dragon14: hmm I haven't tried that.. I've simply been using ruby-install program to handle the installation..
[16:38:36] steph__: has joined #ruby
[16:38:36] ek926m: has joined #ruby
[16:38:49] havenwood: dragon14: It seems you've installed gcc and are running into an issue with High Sierra and GCC.
[16:39:51] dragon14: havenwood: yes that's correct. This all started with the High Sierra upgrade (I previously had 2.3.4 installed.. but it stopped working with a readline error after the high sierra update
[16:39:56] havenwood: dragon14: I'd recommend going back to the default clang, unless you really want to debug the gcc/high sierra issues.
[16:40:13] dragon14: I'm using ruby-install application (always have)
[16:40:47] dragon14: so I removed 2.3.4 ruby.. and tried a reinstall with ruby-install but now getting this syslog gcc error
[16:41:10] havenwood: dragon14: So you've installed gcc, and ruby-install is using it. That's not the default setup on macOS.
[16:41:17] havenwood: dragon14: Check: gcc --version
[16:41:40] havenwood: dragon14: With the macOS command line tools, it'd be expected to be: Apple LLVM version 9.0.0 (clang-900.0.38)
[16:41:47] dragon14: Apple LLVM version 9.0.0 (clang-900.0.38)
[16:41:50] rkoller: has joined #ruby
[16:43:31] havenwood: dragon14: Could you confirm that setting CC doesn't work, just to rule it out?: ruby-install ruby 2.3.4 -- CC=clang
[16:44:12] claudiuinberlin: has joined #ruby
[16:44:13] dragon14: interesting.. my first attempt to run ruby-install errored saying it could't find gcc6 so I brew installed it.. which allowed it to get started.. but then the error I relayed..
[16:44:17] dragon14: ok trying that now havenwood
[16:44:38] havenwood: dragon14: The issue is that it's using gcc, and running into this gcc/macOS bug.
[16:44:53] havenwood: It looks like some folk resolve that linking bug by reinstalling macOS >.>
[16:45:10] havenwood: So I'd probably use clang until they get that resolved. ;-P
[16:45:16] dragon14: yeah I read that.. uh.. this is my work computer.. I'm not completely reinstalling the OS lol
[16:46:00] _aeris_: has joined #ruby
[16:46:21] havenwood: dragon14: But the issue is likely going to be the same whether you use RVM or ruby-install or build Ruby yourself, as long as you're using gcc on that install of macOS.
[16:47:11] dragon14: havenwood yeah that makes sense.. hopefully forcing CC to clang does the trick
[16:47:29] matthewd: > errored saying it could't find gcc6
[16:47:36] matthewd: Do you happen to still have that message in scrollback?
[16:47:44] matthewd: It sounds.. unexpected
[16:48:09] dragon14: matthewd I don't sadly.. I went back and looked when I mentioned it.. but it's outside my buffer :(
[16:48:41] havenwood: I suspect a badly linked gcc from an old install.
[16:49:10] havenwood: Default clang never got involved.
[16:49:11] havenwood: It is curious.
[16:49:25] dragon14: havenwood so that appears to have worked!
[16:49:41] havenwood: dragon14: congrats!
[16:50:19] dviola: has joined #ruby
[16:50:56] dragon14: ah you know what.. I was forcing it to use gcc6 in my old alias *sigh*
[16:51:05] dragon14: ruby-install --no-install-deps ruby $1 -- --disable-install-doc --with-gcc=gcc-6
[16:51:31] dragon14: now I'm not sure why (I set up that alias like 4 years ago)
[16:51:38] havenwood: dragon14: I was confused why that was happening, that explains it. The fact that `gcc` wasn't aliased was hurting my brain.
[16:51:43] troulouliou_div2: has joined #ruby
[16:52:18] dragon14: havenwood you and me both honestly lol..
[16:52:40] matthewd: I think you used to need gcc for 1.8 or something, maybe?
[16:53:07] dragon14: yeah most likely ruby-1.9.3-p392
[16:53:13] havenwood: anything older than older than 1.9.3-p429
[16:53:26] havenwood: that was the patch with the fix
[16:53:33] dragon14: I'll just go ahead and update that alias right now
[16:54:25] dragon14: havenwood: I truly appreciate your help.. I've been scratching my head for hours on this..
[16:54:31] bitemyapp: has left #ruby: ()
[16:54:32] havenwood: dragon14: you're welcome
[16:55:19] dn`_: has joined #ruby
[16:55:33] mgorbach: has joined #ruby
[16:55:48] csk157_1: has joined #ruby
[16:56:56] mgorbach: has joined #ruby
[16:57:58] dragon14: now to try and track down why all these gem ignores are happening and requesting I pristine them all after the high sierra update.. *sigh*
[16:58:37] dragon14: I haven't coded in over a year now (been playing scrum master).. but my company just fired everyone else and left only me.. good news is I get to code again.. bad news is NONE of my dev environments are up to date oh the joy
[16:58:46] dragon14: (well not fired.. layed off)
[17:00:58] mgorbach: has joined #ruby
[17:01:21] ujjain: has joined #ruby
[17:01:21] ujjain: has joined #ruby
[17:01:27] charliesome: has joined #ruby
[17:02:00] tomphp: has joined #ruby
[17:03:09] MrBusiness: has joined #ruby
[17:04:02] vipaca: has joined #ruby
[17:10:33] profP: has joined #ruby
[17:12:38] conta2: has joined #ruby
[17:14:17] veeti: has joined #ruby
[17:15:22] Aloy: has joined #ruby
[17:18:35] charliesome: has joined #ruby
[17:20:02] john__: has joined #ruby
[17:20:26] kies: has joined #ruby
[17:21:03] FahmeF: has joined #ruby
[17:22:02] jdawgaz: has joined #ruby
[17:23:28] cabotto: has joined #ruby
[17:23:43] SCHAPiE: has joined #ruby
[17:25:40] brendan-: has joined #ruby
[17:26:14] tomphp: has joined #ruby
[17:28:44] bmurt: has joined #ruby
[17:28:46] Dimik: has joined #ruby
[17:29:22] ek926m: has joined #ruby
[17:29:28] jdawgaz: has joined #ruby
[17:29:32] orbyt_: has joined #ruby
[17:31:00] csk157_1: has joined #ruby
[17:31:15] profP: has left #ruby: ()
[17:33:31] orbyt_: has joined #ruby
[17:33:37] mjolnird: has joined #ruby
[17:38:01] AndBobsYourUncle: has joined #ruby
[17:39:47] SeepingN: has joined #ruby
[17:40:05] jdawgaz: has joined #ruby
[17:40:14] veeti: has joined #ruby
[17:43:20] claudiuinberlin: has joined #ruby
[17:45:04] jrafanie: has joined #ruby
[17:48:55] vipaca: has joined #ruby
[17:49:00] alnewkirk: has joined #ruby
[17:50:40] jdawgaz: has joined #ruby
[17:52:46] blackwind_123: has joined #ruby
[17:53:28] alfiemax: has joined #ruby
[17:55:49] jdawgaz: has joined #ruby
[17:57:34] _sfiguser: has joined #ruby
[17:57:50] blackwind_123: has joined #ruby
[18:01:18] jdawgaz: has joined #ruby
[18:03:30] cagomez: has joined #ruby
[18:07:33] impermanence: has joined #ruby
[18:08:28] Nexer: has joined #ruby
[18:15:51] conta2: has joined #ruby
[18:18:14] conta2: has joined #ruby
[18:18:48] cdg: has joined #ruby
[18:19:05] michael1: has joined #ruby
[18:22:55] cdg_: has joined #ruby
[18:25:54] alex``: has joined #ruby
[18:27:39] nixfreak: has joined #ruby
[18:28:08] nixfreak: using osx and brew
[18:28:20] nixfreak: installed rbenv and set 2.4.2 to local and global
[18:28:37] nixfreak: but ruby -v still says 2.0
[18:28:51] nixfreak: what I am I missing ?
[18:29:37] croberts: not running linux
[18:30:29] nixfreak: haha funny , don't have a choice at work
[18:30:38] nixfreak: but I agree
[18:31:04] cdg: has joined #ruby
[18:31:56] Antiarc: has joined #ruby
[18:32:24] baweaver: http://ryanbigg.com/2015/06/mac-os-x-ruby-ruby-install-chruby-and-you
[18:32:24] adlerdias: has joined #ruby
[18:32:27] baweaver: Give that a run through
[18:32:45] jdawgaz: has joined #ruby
[18:33:05] vipaca: has joined #ruby
[18:34:25] Puffball: has joined #ruby
[18:35:25] impermanence: I've installed this: https://github.com/postmodern/combinatorics and when I call Set['ab', 'cd', 'ef'].powerset I am returned #<Enumerator: #<Set: {"ab", "cd", "ef"}>:powerset> as opposed to what the documentation says powerset should return. Am I missing something here? I expected an array of objects...
[18:36:58] hackeron: has joined #ruby
[18:38:55] MrPunkin: has joined #ruby
[18:39:05] lupine: looks like it quacks fine
[18:40:11] MrPunkin: I’m calling a bash script via %x(/bin/bash /path/to/script) and within that script I have a command that is supposed to run in the background (ends with &). It seems that if I run the shell script directly from the command line it does, however it seems that Ruby is waiting for the background subprocess to finish too. How can I program around this?
[18:40:54] impermanence: lupine: oh, yep. I see now. calling each on the enumerator return has straightened me out.
[18:40:59] impermanence: if you were talking to me.
[18:42:25] eckhardt: has joined #ruby
[18:42:41] claudiuinberlin: has joined #ruby
[18:45:06] Antiarc: has joined #ruby
[18:45:09] lupine: MrPunkin: don't use `^x`. Use `Process::spawn` instead
[18:46:05] MrPunkin: lupine: thanks for the direction, much appreciated
[18:46:57] Devalo: has joined #ruby
[18:48:55] impermanence: How do I access elements in a data structure such as: #<Set: {3, 5, 7}>
[18:50:38] elomatreb: Depends on what you mean by "access elements"
[18:51:45] impermanence: elomatreb: touch them to be used. they don't need to be mutated, deleted, nothing else.
[18:51:52] jrafanie: has joined #ruby
[18:52:05] impermanence: I guess I should just use the Set methods it seems...
[18:52:35] elomatreb: "touch them"? I'm not sure I get what you mean
[18:53:38] havenwood: impermanence: Are you trying to find a particular item in the set or iterate over all items or what?
[18:54:03] impermanence: havenwood: iterate over all items
[18:54:12] impermanence: havenwood: looks like each is fine...
[18:54:47] havenwood: impermanence: Yes, set mixes in Enumerable as well - which works off of #each.
[18:55:22] impermanence: I suppose this ...each { |i| i.each { |j| p j } } is disgusting? :)
[18:55:45] eckhardt: has joined #ruby
[18:55:56] impermanence: This at least prints out what I'm looking to do, essentially
[18:56:48] impermanence: which is iterate of every element in something like this: [[1,2,3], [1,2], [1,3], [2,3], [1], [2], [3]]
[18:57:30] jenrzzz: has joined #ruby
[18:57:30] jenrzzz: has joined #ruby
[18:58:11] vipaca: has joined #ruby
[18:58:32] lxsameer: has joined #ruby
[18:59:46] impermanence: Is a nested each like that terrible? I would guess that if I have to do that then probably there is a better way to do what I want.
[19:03:07] vipaca: has joined #ruby
[19:04:38] elomatreb: Try #flatten?
[19:07:03] impermanence: elomatreb: yep
[19:08:57] al2o3-cr: or inject(:+) :P
[19:09:35] InfinityFye: has joined #ruby
[19:10:05] al2o3-cr: yeah, flatten your array :)
[19:10:53] elomatreb: flatten(1) if you don't want it to recurse, btw
[19:10:54] jdawgaz: has joined #ruby
[19:11:30] ruby[bot]: -b *!*@gateway/web/cgi-irc/kiwiirc.com/ip.213.138.73.186$#ruby-banned
[19:12:24] alfiemax: has joined #ruby
[19:13:43] charliesome: has joined #ruby
[19:14:46] impermanence: elomatreb: this is specifically what I am trying to do: ...
[19:15:12] elomatreb: Recursing into nested arrays?
[19:15:25] impermanence: elomatreb: one sec
[19:15:35] synthroid: has joined #ruby
[19:16:29] impermanence: if any of [1, 2, 3] are factors of some number, then begin to check if the subsets of such an array are also factors: [1, 2], [1, 3], [2, 3] ... etc.
[19:16:31] veeti: has joined #ruby
[19:16:48] nixfreak: sweet the directions for ruby-install worked great
[19:16:53] impermanence: I started thinking I would use Combinatorics#powerset
[19:16:58] mtkd: has joined #ruby
[19:17:02] nixfreak: now i have ruby as 2.4.2 thanks alot appreaciate
[19:17:10] impermanence: which I suppose I could...
[19:17:53] impermanence: but now, algorithmically I realize that if any of [1, 2, 3] are not factors then I don't even need to produce or check their corresponding subsets...
[19:18:24] elomatreb: I'm too tired to think about something like that, sorry :)
[19:18:36] jrafanie_: has joined #ruby
[19:18:42] impermanence: elomatreb: that makes [1,2].size of us :)
[19:21:50] cagomez: has joined #ruby
[19:24:56] guacamole: has joined #ruby
[19:25:43] watzon: Question since I can't seem to find an answer by searching. What does it mean when a single quotation mark is used as a parameter? For instance, https://github.com/svenfuchs/i18n/blob/master/lib/i18n.rb#L341
[19:27:28] dionysus69: has joined #ruby
[19:27:29] Papierkorb: watzon: that's an empty string
[19:27:41] tomphp: has joined #ruby
[19:27:45] Papierkorb: there are two single-quots
[19:27:47] nopolitica: has joined #ruby
[19:29:30] dminuoso: watzon: It's a convention for so-called predicate methods.
[19:29:31] watzon: Lol I don't know what happened, I could've sworn it was a single double-quote a second ago
[19:29:38] watzon: I think I need to sleep
[19:29:39] dminuoso: watzon: (it's methods that are expected to return true or false)
[19:29:47] dminuoso: watzon: but know that its just part of the method name, so it's just "convention"
[19:30:05] havenwood: >> "''".bytes
[19:30:11] ruby[bot]: havenwood: # => [39, 39] (https://eval.in/890945)
[19:30:31] LBRapid: has joined #ruby
[19:30:40] dminuoso: watzon: you can also have a trailing !, but the meaning of that is muddy (sometimes it means "dangerous", or it means "mutates", or it means "exception-throwing-variant", or it means "this is some imperative stuff")
[19:30:45] synthroid: has joined #ruby
[19:30:56] watzon: Ahh I gotcha. That's good to know
[19:31:55] tomphp: has joined #ruby
[19:32:19] imode: has joined #ruby
[19:33:55] stephh: has joined #ruby
[19:37:01] vipaca: has joined #ruby
[19:38:03] jamesaxl: has joined #ruby
[19:42:56] chouhoulis: has joined #ruby
[19:43:34] orbyt_: has joined #ruby
[19:45:16] vipaca: has joined #ruby
[19:46:07] eckhardt: has joined #ruby
[19:49:45] jottr: has joined #ruby
[19:51:01] AndBobsYourUncle: has joined #ruby
[19:53:06] enterprisey: has joined #ruby
[19:54:28] cagomez: has joined #ruby
[19:55:19] devn: has joined #ruby
[19:55:52] uZiel: has joined #ruby
[19:56:16] ahoyhere: has joined #ruby
[19:56:31] devn: is there a way, once i'm in the ruby runtime, or via a flag on startup, to forcefully set the seed used for calls to String#hash ?
[19:56:32] alnewkirk: has joined #ruby
[19:56:44] guacamole: has joined #ruby
[19:56:55] milardovich: has joined #ruby
[19:57:28] devn: why you may ask? obfuscated ruby, nothing serious.
[19:59:31] dalitom: has joined #ruby
[19:59:53] dalitom: hello good people !
[20:00:00] kus_ubuntui686: has joined #ruby
[20:02:00] cdg: has joined #ruby
[20:03:17] apeiros: devn: sadly no. afair there's no code in mri to set String#hash's seed :(
[20:03:32] devn: apeiros: surely there must be some filthy hack
[20:03:45] cdg_: has joined #ruby
[20:03:48] apeiros: last time I looked, the filthy hack would have involved patching ruby
[20:03:49] devn: does it get set down at the C level?
[20:03:53] baweaver: set_trace_func maybe
[20:04:09] devn: baweaver: ?
[20:04:39] baweaver: https://aphyr.com/posts/173-monkeypatching-is-for-wimps-use-set-trace-func
[20:05:06] jamesaxl: has joined #ruby
[20:05:26] segy: has joined #ruby
[20:06:11] dminuoso: baweaver: Oh boy that so reminds me of this:
[20:06:13] dminuoso: https://thedailywtf.com/articles/Disgruntled-Bomb-Java-Edition
[20:06:59] PaulCapestany: has joined #ruby
[20:07:09] dminuoso: Its a wonderful article though
[20:07:41] elomatreb: The api looks a bit different now though (does set_trace_func even still work, or is it all in TracePoint now?)
[20:08:07] devn: baweaver: of course a post like that would come from aphyr :D
[20:08:09] dminuoso: elomatreb: It still works, but its deprecated.
[20:08:50] baweaver: Ah, TracePoint finally took over?
[20:08:51] baweaver: Shows how often I use that part
[20:09:29] ozcanesen: has joined #ruby
[20:11:46] vipaca: has joined #ruby
[20:14:56] Devalo: has joined #ruby
[20:15:50] snickers: has joined #ruby
[20:15:52] marr: has joined #ruby
[20:17:38] postmodern: has joined #ruby
[20:22:32] csk157_2: has joined #ruby
[20:23:37] veeti: has joined #ruby
[20:24:19] jdawgaz: has joined #ruby
[20:25:07] cagomez: has joined #ruby
[20:26:26] RickHull: has joined #ruby
[20:28:50] DoubleMalt: has joined #ruby
[20:29:17] claudiuinberlin: has joined #ruby
[20:30:38] cdg: has joined #ruby
[20:32:45] jottr: has joined #ruby
[20:35:35] RougeR: has joined #ruby
[20:36:09] dalitom: question... how do I iterate inside heredoc ?
[20:36:39] elomatreb: A heredoc is a string. #{...} works, if that's what you mean
[20:37:49] matthewd: You don't; a heredoc is a string, not a template language.
[20:38:08] argoneus: hello, I'm wondering, is Ruby suited for a websocket server project? trying to learn the language on something I might actually use
[20:38:21] argoneus: I thought it'd be similar to python but blocks are killing me inside
[20:39:03] elomatreb: Ruby is suitable for websockets, recent versions of Rails ship with built-in support for them. And you'll miss blocks in nearly every language after you "get" them :P
[20:39:11] Papierkorb: How are blocks "killing" you?
[20:39:39] matthewd: argoneus: It can certainly be done, and the code will look idiomatic and pleasant. But it's not going to be as high-concurrency as some other languages (well, runtimes) which have that as a stronger focus.
[20:39:41] Papierkorb: argoneus: Rails stuff isn't vanilla websockets. There's faye-websockets, which does what you want.
[20:40:26] argoneus: I'm not planning to use rails, I plan to use something else altogether to make the client
[20:40:30] matthewd: Papierkorb: I'm not sure I'd put something that uses EventMachine next to the word "vanilla", but okay ;)
[20:40:34] argoneus: and I don't need high performance, I just want to actually learn the language
[20:41:00] argoneus: and by killing me, I mean that I understand in my head how blocks work, but then I see some examples of code that uses blocks and I'm back to square one and don't understand how it works
[20:41:03] Papierkorb: matthewd: faye implements vanilla websockets without any protocol on top.
[20:41:09] matthewd: argoneus: So yes, as an educational exercise in a domain you're potentially familiar with, it's a perfectly reasonable choice
[20:41:20] Papierkorb: matthewd: And thankfully, you don't actually have to "use" EM for faye to use it.
[20:41:59] matthewd: Papierkorb: Oh?!... I thought the whole reason I rewrote that stuff was to get rid of EM
[20:43:11] Papierkorb: matthewd: Mh, it's been a good while since I used plain faye. I think I only needed to copy the base "loop" from somewhere and it worked for me. Mostly I use Faye with Roda on Puma et al, so I don't have to mess with any of that *yay*
[20:43:41] argoneus: like, when looking at the example code for faye-websockets
[20:44:03] argoneus: (https://github.com/faye/faye-websocket-ruby from here)
[20:44:11] jenrzzz: has joined #ruby
[20:44:29] argoneus: which part of the example block keeps track of which client it's responding to? or do I need to do that
[20:44:35] veeti: has joined #ruby
[20:44:47] argoneus: I just can't picture the flow in my head
[20:45:10] RickHull: have you worked with event architecture before? reactor pattern? inversion of control?
[20:45:23] argoneus: nope, that'd probably be a good place to start
[20:45:33] RickHull: yeah, you're taking on a big conceptual load with this
[20:45:34] argoneus: I've only done raw TCP servers before which was considerably easier
[20:45:45] ur5us: has joined #ruby
[20:45:47] matthewd: argoneus: In what languages?
[20:46:00] argoneus: using asyncio
[20:46:01] RickHull: you can also look at Phoenix, a project in the Elixir language
[20:46:13] RickHull: i'll stop shilling for #elixir soon I promise :)
[20:46:32] matthewd: RickHull: You think that would be an effective strategy for learning Ruby?
[20:46:38] Papierkorb: argoneus: EventMachine ("EM") basically does async I/O in ruby. Never done Python, so can't compare
[20:46:57] AndBobsYourUncle: has joined #ruby
[20:47:26] argoneus: the syntax is way different
[20:47:43] RickHull: matthewd: no, but it might help the programmer :)
[20:47:53] jdawgaz: has joined #ruby
[20:48:05] argoneus: also it's more
[20:48:17] argoneus: I can understand from the examples how to use the code, but I'd like to understand what it actually does under the hood
[20:48:25] argoneus: and the more I try to do this in ruby the more I regret it every time
[20:48:55] Papierkorb: I wouldn't want to learn Ruby through EM
[20:48:59] RickHull: i'm not a fan of inversion of control and EM -- I find it hard to reason about
[20:49:13] RickHull: there are lots of other approaches in ruby
[20:49:27] matthewd: argoneus: If you want to dig in, to understand language fundamentals, you'll likely be better off with a much smaller (and yes, consequently, less interesting) problem
[20:49:43] stephh: has joined #ruby
[20:49:55] argoneus: well, the websocket part is just a tiny part of the server, right
[20:50:05] argoneus: I still need to actually have the server do things, so I can take the websocket lib as magic for now
[20:50:07] Papierkorb: "the server"?
[20:50:08] RickHull: you're buying into the EM architecture first
[20:50:40] Papierkorb: argoneus: do you plan on having a web interface and use websocket in that?
[20:50:52] argoneus: yes, and/or use electron or similar
[20:50:59] argoneus: it's a server for a simple text game
[20:51:10] argoneus: not too concerned about the client atm
[20:52:07] benzrf: has left #ruby: ("WeeChat 1.9.1")
[20:52:28] Papierkorb: Well. EM is the big hammer, handling multiple clients per thread and stuff. It's what you want if you want to build stuff, maybe not when you want to learn stuff.
[20:52:58] argoneus: implementing websockets by myself is probably out of the question
[20:53:04] RickHull: i'd be tempted to look at what sinatra does for websockets
[20:53:08] matthewd: It's not even what I want when I build stuff ;)
[20:53:12] argoneus: ruby doesn't seem too ideal for low level bitwise work
[20:53:14] Papierkorb: Websocket is actually a nice, simple protocol overall
[20:53:16] argoneus: or am I wrong
[20:53:29] RickHull: argoneus: ruby is a great language for io heavy problems
[20:53:31] matthewd: There's also a library you can use for that
[20:53:38] RickHull: string manipulation, etc
[20:53:52] argoneus: yes but I mean stuff like
[20:53:58] Papierkorb: you can write/read binary structures using Array#pack and String#unpack (as far the stdlib is concerned)
[20:54:04] matthewd: The Rails websocket implementation does its own IO & events, but uses a gem to handle the actual protocol parsing
[20:54:05] argoneus: "extract the first 15 bytes from the tcp stream and convert them to a value"
[20:54:14] RickHull: bread & butter
[20:54:34] RickHull: this takes no wall clock time relative to IO
[20:54:42] Papierkorb: argoneus: That's no problem to do
[20:54:42] argoneus: then how about writing my own simple websocket implementation on top of TCPServer
[20:54:53] argoneus: I can always just plug the faye-websockets lib in later, right
[20:55:26] Papierkorb: Faye is more complex, but in theory, yes
[20:56:07] argoneus: writing my own WS implementation seems like good practice, since it's a lot of io work
[20:56:24] argoneus: thanks a lot, just one last thing, or two
[20:56:34] argoneus: 1) is TCPServer the go-to for just a tcp server or are there issues with that too?
[20:56:50] Papierkorb: TCPServer is the basic tcp server everyone relies on
[20:56:50] matthewd: I might argue that "a lot of io work" isn't necessarily the most valuable thing to practice, but that's just opinion
[20:57:04] workmad3: has joined #ruby
[20:57:07] RickHull: it's a C-based API mostly -- so be familiar with berkeley sockets and you'll be fine
[20:57:19] argoneus: I'm used to raw sockets so that's nice
[20:57:29] selim: has joined #ruby
[20:57:40] RickHull: you can do a #select loop etc
[20:57:43] argoneus: and 2) is it difficult in ruby to write unit tests for network stuff? or in general things out of my control
[20:58:01] tomphp: has joined #ruby
[20:58:12] matthewd: No more or less difficult than any other language, I wouldn't think
[20:58:17] jrafanie: has joined #ruby
[20:58:21] RickHull: i would write as much of your logic as functions (rather than methods) that take small binary strings
[20:58:32] Papierkorb: argoneus: But as matthewd said, the WS stuff by itself may not really show Ruby. Ruby starts to get really interesting when you're juggling structures
[20:58:37] matthewd: Either you arrange to mock out the actual IO, or your test has to provide something on the other end of the socket
[20:58:39] RickHull: and have a thin layer that reads the socket and provides small strings to the logic layer
[20:58:44] argoneus: well, like I said, it's a text game server
[20:58:49] argoneus: I need to implement the whole text game logic
[20:58:54] matthewd: I'd focus on that
[20:59:01] polishdub: has joined #ruby
[20:59:15] matthewd: And not spend time reimplementing a protocol layer you can get for free
[20:59:32] Papierkorb: .. Except if you always wanted to know how websockets work
[20:59:36] argoneus: hmm, well, here's what I'll do
[20:59:44] ek926m: has joined #ruby
[20:59:45] RickHull: for learning and toy projects, it's best to start small rather than ambitious
[20:59:45] Papierkorb: If you couldn't care less, then ...
[20:59:51] argoneus: I've never actually tried implementing WS before, so I'll try that first, if it proves to be too painful, I'll use a lib and just make the game instead
[20:59:53] matthewd: Learning how to write pseudo-C in ruby isn't a good strategy for learning ruby -- but yes, is potentially a great strategy for learning those low level details
[21:00:03] argoneus: does that work
[21:00:12] guacamole: has joined #ruby
[21:00:30] argoneus: I'm a control freak in the sense that I want to know exactly what my program does >_>
[21:00:38] argoneus: instead of relying on magic function calls
[21:00:49] matthewd: Then focus on learning not to.. that.
[21:01:13] matthewd: Because that philosophy does not a productive programmer make.
[21:01:31] argoneus: I'm still learning, it's not my job yet
[21:01:33] cagomez: is there a way to conditionally add a k,v to a hash?
[21:01:40] RickHull: hsh[k] = v if cond
[21:01:41] Papierkorb: cagomez: `if`
[21:02:06] argoneus: then again... I guess there's a learning curve to using the big boy libraries too?
[21:02:07] cagomez: say I have it like so: {foo:1 , bar: 2}. I want to add :baz if x
[21:02:18] argoneus: like, I can't just "learn" ruby and then download rails and suddenly be familiar with it, right
[21:02:27] RickHull: hsh[:baz] = 'quux' if x
[21:02:45] ramfjord: has joined #ruby
[21:02:56] matthewd: argoneus: You're obviously free to do what you like -- this is all just Opinions. But yes, there are things to learn anywhere.. and learning when to build and when to "buy" is itself a useful skill.
[21:03:17] RickHull: argoneus: start with smaller things like a project euler problem
[21:03:19] Devalo: has joined #ruby
[21:03:31] RickHull: rather than investing into an architecture blindly
[21:03:36] matthewd: argoneus: You're going to be learning an API, whose implementation you don't know, either way. Might as well go for the higher level one that gets you closer to a goal.
[21:04:18] Papierkorb: argoneus: I'll provide a counter to matthewds view and say that if you really want to know how X works, you should learn how to do X. If that's websockets, then that's great! Just do know however that it may not be something you do for 2hrs and "be done" with it. But only you know yourself enough to know if you should add the websocket stuff on top of learning ruby, or not. But I'm on par with saying that the websocket stuff will probably not
[21:04:19] Papierkorb: teach you what ruby is really good at.
[21:04:22] RickHull: you'll want to be reasonably fluent in the language before you start thinking about project structure, architecture, how to make things usable and reusable
[21:04:37] jenrzzz_: has joined #ruby
[21:04:49] argoneus: I think I see what you mean
[21:04:54] RickHull: s/thinking about/investing in/
[21:05:06] argoneus: the average javascript developer is probably way more productive than me
[21:05:07] cagomez: iterating over hashes in ruby don't have a guaranteed order, right? like {foo: 1, bar: 2}
[21:05:13] argoneus: but they probably don't know what a higher order function is
[21:05:15] matthewd: Papierkorb: I'm not sure we're disagreeing :P
[21:05:17] argoneus: well, they do intuitively
[21:05:21] argoneus: something like that?
[21:05:21] Papierkorb: argoneus: Learning is always productive!
[21:05:33] RickHull: cagomez: they used to be unordered. the current implementation maintains insertion order
[21:05:39] Papierkorb: argoneus: Even if you go out later on and learned that you hate something, that's an important thing to know
[21:05:45] RickHull: I believe the order is insertion order
[21:05:51] argoneus: fair enough
[21:05:51] segy: has joined #ruby
[21:06:01] argoneus: I'll just try implementing my own WS until I start hating it
[21:06:04] argoneus: then I'll look into libs
[21:06:16] argoneus: thanks for the help anyhow
[21:06:23] mson: has joined #ruby
[21:06:33] argoneus: rubyists seem like a nice bunch :=)
[21:06:47] RickHull: argoneus: start with that faye project -- look into its codebase and dependencies
[21:07:15] charliesome_: has joined #ruby
[21:07:42] RickHull: argoneus: e.g. https://github.com/faye/faye-websocket-ruby/blob/master/faye-websocket.gemspec#L19
[21:08:39] Papierkorb: argoneus: As I said, Ruby is really good when you start (what I call) to "juggle structures". Kiss that `for` loop good-bye, you won't miss it! Once you get the hang of it, using `each`, `map`, `reduce`, `group_by` (and a ton of other methods like that) gets so much fun that on average, people don't know how they could live without before
[21:08:45] argoneus: I just realized how the pattern actually works
[21:08:59] argoneus: the websocket server example isn't the full program, I still need some "rack" to run it in
[21:09:10] argoneus: it makes sense now
[21:09:18] cagomez: has joined #ruby
[21:09:25] RickHull: yeah -- rack is a bit of webserver plumbing -- a standard interface and impl to build webservers from
[21:09:42] Papierkorb: Rack is *the* base middleware library for webserver things. it connects a webserver lib to the web framework lib on top
[21:09:48] RickHull: chris2 bless
[21:10:36] argoneus: so basically whenever this "rack" receives a request, it calls the lambda stored in App, and creates a new websocket out of the client
[21:10:42] argoneus: and then it's just callbacks on events
[21:10:46] argoneus: well that's simple
[21:10:50] hgost: has joined #ruby
[21:11:05] RickHull: Papierkorb has a good point about blocks -- I suggest starting with `each` and seeing how it's handier and cleaner than foreach (only slightly)
[21:11:19] RickHull: once you get the hang of each, then `map` starts to make sense
[21:11:24] RickHull: and you see the general pattern
[21:11:43] Papierkorb: argoneus: You mentioend "higher order functions" before. Did you use a FP language before?
[21:13:32] argoneus: I've done a bit of common lisp if you want strictly FP, but python supports higher order functions
[21:13:46] argoneus: but no, not really
[21:13:55] argoneus: I just know what it is
[21:14:20] Papierkorb: Ah ok. Well, we basically copied `map` and friends from FP.
[21:14:43] RickHull: python's list comprehensions are similar but much clunkier
[21:14:45] Papierkorb: Ruby is "Good OOP with Functional Programming The Good Parts"
[21:14:54] argoneus: I'm familiar with each and map and reduce and such
[21:15:08] RickHull: it's more about being familiar with block semantics
[21:15:14] RickHull: knowing they are closures
[21:15:16] Papierkorb: if only "kind of", that'll turn into a "not only kind of" quickly :)
[21:15:18] RickHull: and how to work with yield
[21:15:31] argoneus: I'm actually not 100% on block semantics yet
[21:15:49] workmad3: has joined #ruby
[21:16:10] argoneus: the way I see it, when I call "yield x", it passes 'x' into an outside block currently calling the function, then the function does <stuff> and whatever is returned from the block is returned back into the yield statement, so I can assign it or put it back into the structure or such
[21:16:16] argoneus: probably wrong
[21:16:29] Papierkorb: nah sounds about correct
[21:17:22] Papierkorb: blocks are basically embedded anonymous functions. Nothing new in that regard, the interesting part is how it's integrated into the language
[21:17:22] RickHull: the day you write your first method that takes a block and handles it correctly is the day you become a Rubyist :)
[21:18:37] argoneus: what I don't understand yet and didn't find proper doc on
[21:18:41] argoneus: is how to_enum works
[21:18:57] argoneus: like, if I'm writing some custom each, there's often something like
[21:19:06] argoneus: return to_enum(:customeach) unless block_given
[21:19:38] argoneus: it returns an "enumerator", so I can iterate over it at a later time, but I don't get *how* it works
[21:19:39] RickHull: I believe that's an enumerator, which is kind of plumbing-type stuff
[21:20:14] RickHull: here is a dense example of blocks and enumerable, see if this makes sense: https://github.com/rickhull/compsci/blob/master/lib/compsci/fit.rb#L14
[21:20:27] argoneus: is an enumerator like a reference to the current function
[21:20:28] RickHull: there is no explicit use of an enumerator, FYI
[21:20:32] argoneus: so if I call .each on the enumerator it calls the same func
[21:21:40] RickHull: i'm not too good on enumerators, but I believe Enumerable#map returns an enumerator
[21:22:05] argoneus: yeah, unless you give it a block, then it just yields the values
[21:22:13] agent_white: has joined #ruby
[21:22:14] argoneus: and saves them back
[21:22:20] jenrzzz: has joined #ruby
[21:22:28] RickHull: and so you can do [1,2,3].map { |n| n ** 2} or [1,2,3].map.with_index { |n, i| n * i }
[21:24:43] charliesome: has joined #ruby
[21:25:12] Rapture: has joined #ruby
[21:25:21] PaulCape_: has joined #ruby
[21:26:51] bronson: has joined #ruby
[21:27:13] argoneus: I had to stare at that sigma function for 10 minutes before I got it
[21:27:21] argoneus: &block means it might be nil, right
[21:27:35] RickHull: the map(&block) is shorthand syntax
[21:28:14] RickHull: it's equivalent to enum.map { |val| yield val }
[21:28:26] RickHull: (I think, more or less)
[21:29:22] RickHull: there is a way to explicitly yield to the block parameter in the method definition, or you can just call naked yield, or you can have an implicit block parameter and do: yield blah if block_given?
[21:29:39] RickHull: if you yield and ruby can't find a block, it will error
[21:29:58] quobo: has joined #ruby
[21:29:59] RickHull: I'm a bit fuzzy on this stuff, beware :)
[21:30:40] argoneus: my head hurts, but I somewhat get it
[21:31:07] RickHull: btw, Enumerable#inject and Enumerable#reduce are aliases
[21:31:54] RickHull: in english, the sigma function says: enum is an array like [1,2,3]; if we have a block, apply the block to the enum; now sum the enum
[21:32:01] charliesome_: has joined #ruby
[21:32:27] RickHull: sigma is written with an explicit block parameter in this case. it could be written with an implicit block parameter
[21:32:45] milardovich: has joined #ruby
[21:32:48] matthewd: argoneus: Yes, an enumerator stores the current state of the method, and can resume it
[21:33:17] argoneus: so enumerator#next just... goes until the next yield, and then pauses again?
[21:33:27] argoneus: that's clever
[21:33:31] baweaver: https://medium.com/@baweaver/reducing-enumerable-the-basics-fa042ce6806 :D
[21:33:42] ap4y: has joined #ruby
[21:33:45] baweaver: ACTION shamelessly plugs things
[21:33:58] baweaver: That may help understand some of what goes on
[21:34:25] matthewd: baweaver: That doesn't touch Enumerator, does it?
[21:34:29] RickHull: baweaver: :+1:
[21:34:42] baweaver: Later ones will
[21:34:47] RickHull: it blew my mind when I first learned that map is specific reduce
[21:34:53] baweaver: This one was entirely how you can write these using reduce
[21:35:02] RickHull: does it touch on transducers?
[21:35:05] matthewd: baweaver: I think it's a great answer to the question RickHull is answering, but not to the one argoneus asked ;)
[21:35:11] baweaver: Oh it's headed that way
[21:35:41] argoneus: I really really like the idea of blocks in Ruby, gotta say
[21:35:57] RickHull: remember that they are closures and so can refer to their outer scope
[21:36:01] argoneus: instead of focusing how I'm going to be iterating over what, I focus on what I actually do with the things
[21:36:17] RickHull: any vars inside the block are not saved outside the block, unless they are in scope *above* the block
[21:36:52] Technodrome: has joined #ruby
[21:36:57] RickHull: alternately: any vars introduced within a block go out of scope when the block finishes
[21:37:09] baweaver: >> p2s = Enumerator.new{|y|n=2;loop{y<<n;n=n<<1}; p2s.first(10)
[21:37:11] ruby[bot]: baweaver: # => /tmp/execpad-84ad8895c392/source-84ad8895c392:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/890970)
[21:37:21] baweaver: Ack, forgot one
[21:37:30] AndBobsYourUncle: has joined #ruby
[21:37:52] argoneus: and it's not just for iterating, I suppose? I can even use blocks as callbacks, like I could have something like file.open { |buf| buf << "text" }, and this will open a file, "yield" a buffer which is filled and then returned, and the file writes it into the file and closes it
[21:38:01] argoneus: (is that a valid use of blocks? tho I'm sure this is in the std lib already)
[21:38:34] matthewd: argoneus: Yes. (And yes.)
[21:38:39] Papierkorb: that's exactly like that in the stdlib
[21:39:00] argoneus: that makes a ton of sense though!
[21:39:04] matthewd: Also for callback-callbacks, which will be evaluated later
[21:39:25] RickHull: I called the FactoryFactory and I'm waiting for a callback-callback
[21:39:28] matthewd: ws.on_message { |msg| puts "they said: #{msg}" }; ws.connect!
[21:40:18] matthewd: (as distinct from the file.open example, which you called a callback, but is really more of just a wrapper... the block is only invoked before the original [open, in this case] method returns)
[21:40:19] RickHull: yeah, you can delay evaluation with blocks
[21:40:27] argoneus: so in this case, ws is some socket object, and on_message is... some block inside the ws object, and this block is yielded to from the internal implementation whenever there's a message?
[21:40:44] argoneus: like @message_block
[21:40:45] argoneus: or something
[21:40:53] RickHull: Log.warn build_a_huge_expensive_string() vs. Log.warn { build_a_huge_expensive_string() }
[21:40:57] matthewd: on_message is a method on the websocket, which will take its given block, and store it away for later use, yes
[21:41:07] RickHull: in the second form, if your log level is ERROR, then you don't incur the expense
[21:41:15] argoneus: I get it, then :D
[21:41:20] argoneus: this is awesome
[21:41:44] argoneus: seems like all blocks are are just anonymous functions that take some arguments (or don't)
[21:42:00] RickHull: i could have sworn someone said that already ;)
[21:42:16] matthewd: Yep -- and get passed in a special argument slot
[21:42:18] argoneus: it's a special feeling when I reach the conclusion myself, ok
[21:42:38] argoneus: so it's like
[21:42:53] argoneus: def on_message(block)
[21:43:02] argoneus: @onmessage_block = block if block
[21:43:06] vipaca: has joined #ruby
[21:43:09] argoneus: or something
[21:43:23] RickHull: yeah, procs and lambdas are similar
[21:43:28] matthewd: That's where the special argument slot comes in... in the argument list, it's `&block`
[21:44:34] matthewd: If you think of the meta-signature of a method call, it's (array_of_positional_arguments, block_argument)
[21:45:02] matthewd: So, because it exists outside the set of "normal" args, you need the & sigil to grab it and put it in a variable
[21:45:19] argoneus: how does another method yield to this @onmessage_block or w/e it's called?
[21:45:21] RickHull: if you just want to store the block for calling later, then would it be def on_message(block) or (&block) ?
[21:45:29] matthewd: It's special so that `yield` knows how to find it, for example
[21:45:31] RickHull: i don't quite understand
[21:45:51] matthewd: def on_message(&block); @message_handler = block; end
[21:46:02] matthewd: Then later: @message_handler.call("hello")
[21:46:04] RickHull: what is & doing for us here?
[21:46:19] RickHull: is it unique to blocks?
[21:46:41] matthewd: RickHull: Giving the block argument a name; yes.
[21:46:52] argoneus: you can call a block just like that?
[21:46:56] argoneus: that's pretty rad
[21:47:06] RickHull: and of course they generalize to multiple args
[21:47:26] matthewd: Technically the block becomes a Proc object when you put it in a variable
[21:47:29] cagomez: what does this do? "1"[0...-1]
[21:47:33] vipaca: has joined #ruby
[21:47:44] matthewd: Which is basically a class which represents a block
[21:47:49] baweaver: First to last item in a collection
[21:48:06] matthewd: But it can be handy to know that using yield can be slightly faster, because the object never gets constructed
[21:48:11] argoneus: thanks a lot for this discussion
[21:48:19] argoneus: I actually have somewhat of an idea how the faye-websocket thing works now
[21:48:24] argoneus: like, why its interface is how it is
[21:48:33] baweaver: >> [ [0,1,2,3][0..-1], 'string'[0..-1], 'string'[0..-2] ]
[21:48:34] ruby[bot]: baweaver: # => [[0, 1, 2, 3], "string", "strin"] (https://eval.in/890971)
[21:48:48] argoneus: I was confused how they did stuff like
[21:48:55] argoneus: ws.on :message do |event| ... end
[21:49:13] argoneus: but, all this is is just a method on the websocket, def on(type, &block)
[21:49:30] argoneus: which is then converted to a proc object and stored internally and called whenever like @onmessage.call(event)
[21:49:33] argoneus: is that about right
[21:49:40] matthewd: Yep, exactly
[21:50:42] argoneus: this is a really really really clean and nice syntax for callbacks
[21:51:16] RickHull: where is tenderlove?
[21:51:28] baweaver: Twitter mostly, making puns
[21:51:51] iamyask: has joined #ruby
[21:52:39] RickHull: also here http://tenderlovemaking.com/
[21:53:04] baweaver: avdi still likes IRC
[21:53:17] Papierkorb: I wonder how many visits he receives on that domain who weren't looking for ruby stuff
[21:53:31] c-c: Comments on this method? Its for making named pipes. https://gist.github.com/csmr/c6f7d9e4da7313d60845e5996130beb6
[21:53:52] argoneus: anyway, thanks a lot for the discussion! I learned a lot today
[21:54:00] argoneus: I feel a lot more confident in actually writing something now
[21:54:08] argoneus: have a good evening
[21:54:20] nopolitica: has joined #ruby
[21:54:53] jamesaxl: has joined #ruby
[21:54:58] c-c: - For one I don't know if its a necessary thing to sleep while trying to create a file with system-command, or perhaps that only returns once the file exists.
[21:55:39] vipaca: has joined #ruby
[21:55:45] RickHull: it seems like you'll create several and error out or leak something
[21:55:51] Papierkorb: c-c: 1) underscore prefixes for local vars is weird, throw them out 2) line 2: that's just `if msg&.include? wait_on_str` 3) Aalso, don't put ( ) around conditions 4) Line 30, don't #exit, raise an error instead 5) line 13, remove it, #system only returns once the command ran to completion
[21:55:52] RickHull: and sleep is almost never the right thing to do in a method
[21:56:38] RickHull: almost certainly mkfifo will block until the resource is created or ready
[21:57:03] Papierkorb: c-c: 6) that method can do one thing: Creating and opening a named pipe (That's actually two already!). It shouldn't also wait_on_str on top of that, refactor that feature into a new method
[21:57:04] elomatreb: Even if it doesn't, re-trying the same operation would not be the correct thing
[21:57:16] RickHull: create it once, sleep until it exists
[21:57:22] RickHull: but I wouldn't even
[21:58:04] Papierkorb: c-c: 7) line 11, instead of `while !`, use `until`: `until File.exist? pipe_path`
[21:58:06] RickHull: only crappy APIs make you resort to sleep polling
[21:58:11] c-c: Papierkorb: wow! thanks B)
[21:58:56] RickHull: c-c: you can examine behavior quickly and easily in a REPL like pry or irb
[21:59:39] nopolitica: has joined #ruby
[21:59:52] RickHull: if you're ever tempted to do sleep polling, ask yourself if you're dealing with a crappy API (probably not) or if there is a better way to use it (likely)
[21:59:54] veeti: has joined #ruby
[22:00:25] Papierkorb: c-c: 8) line 12: Avoid using `system("program arg1 arg2 ...")`. Use `system(program, [ arg1, arg2, ... ])` instead. Among other things, your line there will inject the pipe_path into a SHELL. If a (remote) user could control pipe_path, they can do a "shell injection" attack on you (This attack is popular with shitty consumer routers)
[22:02:05] Papierkorb: c-c: You require the first form only if you need shell features, like pipes. If you somehow end up needing that form, use Shellwords, like: `system("ls #{Shellwords.escape some_var}")`. This will escape "some_var" so it can be passed safely there without causing security issues
[22:02:44] Papierkorb: Um yeah I guess that's about it from my end
[22:03:02] RickHull: I always drift toward popen3 or popen2 APIs for dealing with subprocesses
[22:03:04] charliesome: has joined #ruby
[22:03:16] guacamole: has joined #ruby
[22:03:48] Papierkorb: There's nothing wrong with #system if all you want to is to call a command and only check if it was successful.
[22:04:04] Papierkorb: Which is also missing in the showcased code snippet :P
[22:07:01] elomatreb: Even if you discount the security perspective, using the multi-argument form of the subprocess methods is just easier than dealing with escaping for e.g. weird filenames
[22:08:13] mtkd: has joined #ruby
[22:12:59] jphase: has joined #ruby
[22:15:59] charliesome_: has joined #ruby
[22:19:03] jphase: has joined #ruby
[22:19:36] vipaca: has joined #ruby
[22:22:08] cagomez: has joined #ruby
[22:22:10] chiggins: has joined #ruby
[22:22:32] c-c: Ok I improved this a little https://gist.github.com/csmr/c6f7d9e4da7313d60845e5996130beb6
[22:22:50] chiggins: Could anyone recommend a gem that would be able to determind if a given string is the output of a hashing function such as MD5, SHA1, etc?
[22:23:24] GodFather: has joined #ruby
[22:24:15] al2o3-cr: c-c: can you use File.mkfifo?
[22:24:34] jphase: has joined #ruby
[22:24:41] elomatreb: chiggins: For the very basic distinctions like that you should be able to do that just by comparing the length of the string
[22:25:06] chiggins: elomatreb: Yeah that's kind of what I was just thinking. Wasn't sure if there was a more elegant way to do that
[22:25:35] apeiros: /\A\h{@hashlength}\z/
[22:25:51] apeiros: where @hashlength is the length of the given hash function
[22:26:02] apeiros: +of the output
[22:26:17] elomatreb: Normally if you need to process a Hash somewhere either the algorithm should be standardized or there should be a tag on the hash string ("SHA256:deadbeef....")
[22:27:20] elomatreb: It won't be able to distinguish between e.g. SHA2 and truncated SHA3 hashes of the same length, and will not work with base64 encoded hashes (e.g. BLAKE hashes are often base64'd instead of hex, for some reason)
[22:27:42] chiggins: I hear ya. Goal here is to just check any random input, such as IP address or string or whatever. If not IP, check if hash. If not has, then disregard
[22:28:21] RickHull: i mean, a hash is effectively a nonce in some integer space
[22:29:02] RickHull: it would be pretty hard to distinguish any value that could map into an integer space from a nonce
[22:29:22] RickHull: but uh, carry on :)
[22:29:30] chiggins: ¯\_(ツ)_/¯
[22:29:44] chiggins: No worries, I know what I'm doing for the most part
[22:29:49] chiggins: It doesn't need to be 100% valid
[22:29:58] chiggins: More of a sanity check
[22:31:30] RickHull: it might be better to have a whitelist of accepted formats
[22:32:01] RickHull: or I guess def is_hash_looking?(some_str) # returns a score
[22:32:32] elomatreb: tbh if you have any control over the data just specify The One True Algorithm, it's the only sane option in the long run
[22:32:47] elomatreb: (Oh, and encoding as well)
[22:32:55] vipaca: has joined #ruby
[22:33:23] cadillac_: has joined #ruby
[22:34:45] chiggins: RickHull: I like that idea
[22:36:04] RickHull: it could get expensive trying to determine if it looks random enough or whatever
[22:36:10] orbyt_: has joined #ruby
[22:37:02] RickHull: also, my own fault, a predicate method ending in question mark should return a boolean. probably: def hash_looking_score(str) # returns a score; def is_hash?(str, threshold) # calls hash_looking_score
[22:37:12] ledestin: has joined #ruby
[22:39:14] RickHull: what are the odds I can get lorem_ipsum out of md5?
[22:39:39] RickHull: I'll settle for shakespeare monkeys
[22:40:52] jphase: has joined #ruby
[22:44:50] charliesome: has joined #ruby
[22:47:15] oleo: has joined #ruby
[22:47:39] bdonnahue: has joined #ruby
[22:50:15] c-c: Ok, further edits done, I hope you like this https://gist.github.com/csmr/c6f7d9e4da7313d60845e5996130beb6
[22:51:21] veeti: has joined #ruby
[22:51:28] jphase: has joined #ruby
[22:53:40] RickHull: what happens if pipe_path already exists?
[22:54:30] RickHull: e.g. what if it's my .emacs file
[22:56:32] RickHull: rather than calling out to the mkfifo subprocess, you can probably Mkfifo with some stdlib call
[22:56:41] c-c: RickHull: it gets opened
[22:56:41] RickHull: and just bomb out if there is an error
[22:56:50] oleo2: has joined #ruby
[22:56:59] c-c: Its not an error - its an expected.
[22:57:20] RickHull: I kind of doubt it, but fair enough :)
[22:57:27] c-c: Also, last I checked - no mkfifo in ruby - thats why I use system
[22:57:53] RickHull: also, your use of leading underscore vars confuses me
[22:58:18] RickHull: the convention means it's a throwaway var that won't be used further
[22:58:25] c-c: its a thing for when I write new methods. vim completion convenience thing
[22:58:29] RickHull: but you have 3 lines that refer to _msg
[22:58:32] c-c: I clean them out later
[22:58:46] RickHull: i would figure out a different convention or not share it :)
[22:59:08] c-c: sometimes its been used to connote "internal to this method/function"
[22:59:41] RickHull: in ruby, unless I'm mistaken, it means "please don't warn about the fact I'm not using this variable"
[23:00:17] RickHull: you almost always see it where a method returns multiple values but not all are needed
[23:00:33] ruby[bot]: has joined #ruby
[23:00:33] ChanServ: +o ruby[bot]
[23:02:37] RickHull: so where I get the result of named_pipe("~/.emacs"), I can pass it to read_bytes_nonblocking and what happens?
[23:03:09] c-c: Sorry, whats that again?
[23:03:37] RickHull: what's the result of named_pipe("~/.emacs") ?
[23:04:04] c-c: its probably going to fail
[23:04:28] RickHull: oh, I thought you said it gets opened, not an error, it's an expected
[23:04:33] RickHull: where does it fail?
[23:05:02] jgt: has joined #ruby
[23:05:09] c-c: hm, I see your point
[23:05:41] c-c: I guess should somehow test if, is a pipe or regular file
[23:05:47] c-c: not that I know how to
[23:05:51] RickHull: yeah, there's a call for that
[23:05:57] thinkpad: has joined #ruby
[23:06:03] RickHull: look at File or FileUtils
[23:06:24] cagomez: has joined #ruby
[23:07:45] c-c: RickHull: http://i0.kym-cdn.com/entries/icons/facebook/000/022/133/the-treachery-of-images-this-is-not-a-pipe-1948(2).jpg
[23:08:15] tcopeland: has joined #ruby
[23:08:18] RickHull: clearly, it's just a picture of a pipe :)
[23:08:29] c-c: File.pipe?
[23:08:40] RickHull: yep, that should help
[23:08:50] shinnya: has joined #ruby
[23:08:53] RickHull: you'll want to decide on an error handling strategy
[23:09:06] c-c: Its going to be 'die'
[23:09:10] RickHull: by default, I would raise an exception or allow it propagate
[23:09:26] RickHull: i.e. if I called MkFifo on an existing file, i wouldn't rescue the FileAlreadyExists or whatever
[23:09:37] RickHull: but you won't get exceptions like that from a subprocess
[23:09:49] Devalo: has joined #ruby
[23:09:58] al2o3-cr: c-c: what ruby version?
[23:10:01] RickHull: in ruby, raise is an effective 'die'
[23:10:12] RickHull: crash with a message and stacktrace
[23:10:23] RickHull: with an option to recover it at an outer layer
[23:10:36] c-c: al2o3-cr: I seem to be on 2.3 at the moment
[23:10:44] c-c: started this in 2.0 I think
[23:11:08] al2o3-cr: c-c: there is File.mkfifo 2.3+
[23:12:07] c-c: al2o3-cr: thanks
[23:12:14] Gadgetoid: has joined #ruby
[23:12:14] c-c: al2o3-cr: looks like it would work fine here
[23:12:36] al2o3-cr: it'll sure save you a lot of hassle. :)
[23:14:56] RickHull: I like to keep the "happy path" very simple and clean. I don't write conditionals to handle edge cases if the happy path will raise an exception for me
[23:15:05] RickHull: I don't write a lot of rescue clauses except at very outer layers
[23:15:17] mson: has joined #ruby
[23:15:26] c-c: In the engine I'm going to use a temp directory with the pid in the name, so the pipes will be in a unique location
[23:15:51] RickHull: you'll have to be careful that boundaries are maintaining their contracts
[23:16:05] RickHull: or just enforce your contracts and stop worrying
[23:16:09] conta1: has joined #ruby
[23:16:40] c-c: well, it now allows you to make pipes/use existing, otherwise fails
[23:16:41] RickHull: if I'm not sure that the happy path will raise exceptions for me, then I will do extensive validation at the top of the method with a lot of raises
[23:17:09] c-c: not sure if should retry on open or not.
[23:17:24] c-c: or if should also have limit on the number of retries
[23:17:36] RickHull: retries almost always backfire
[23:17:53] RickHull: about 1% of my rescues have retries, and half of those backfired on me
[23:18:04] cagomez: has joined #ruby
[23:18:10] RickHull: just fail fast and let some outer layer deal with it
[23:18:40] RickHull: don't bother with a retry to start with. it can be helpful to have it available for some later patch
[23:19:05] chiggins: has left #ruby: ("WeeChat 1.7.1")
[23:19:25] jgt1: has joined #ruby
[23:20:20] RickHull: keep your scope small: do the one thing, and only if you get good data passed in. validate the data, do the thing. if the underlying system fails, then you probably don't have the context to know the remedy
[23:20:28] cagomez_: has joined #ruby
[23:23:59] charliesome_: has joined #ruby
[23:25:39] AndBobsYourUncle: has joined #ruby
[23:28:05] jdawgaz: has joined #ruby
[23:30:39] RickHull: put another way: use retries only if you're sure you need to. a lot of overly complicated code has bugs resulting from premature anticipation
[23:31:02] c-c: hehe not sure what else to put in the rescue clause
[23:32:38] RickHull: what's the latest?
[23:32:56] RickHull: yeah, don't rescue there
[23:33:06] RickHull: if mkfifo fails, then bomb out
[23:33:22] RickHull: er File#open, or whatever
[23:33:40] apeiros: has joined #ruby
[23:34:00] RickHull: probably you want to have 0 rescues and 0 up to 5 or 10 raises in that method definition
[23:35:13] RickHull: gotta run :)
[23:35:25] c-c: heres the latest https://gist.github.com/csmr/c6f7d9e4da7313d60845e5996130beb6
[23:35:36] c-c: RickHull: thanks for input, have a good one
[23:35:49] RickHull: yeah, i would not rescue an open failure there
[23:36:07] RickHull: instead let it propagate
[23:36:16] RickHull: and the caller of named_pipe can deal with the failure
[23:37:47] RickHull: dang, how do I edit or fork it?
[23:37:59] RickHull: ah, found it
[23:38:02] c-c: Heh the epic 1-in-all named pipe opening method is dwindling in size https://gist.github.com/csmr/c6f7d9e4da7313d60845e5996130beb6
[23:40:29] RickHull: https://gist.github.com/rickhull/757f0c1740c8e9f612f26c9f90c696e6
[23:40:34] charliesome: has joined #ruby
[23:40:55] RickHull: what does File.mkfifo return?
[23:40:57] RickHull: a File object?
[23:41:15] alnewkirk: has joined #ruby
[23:41:24] jdawgaz: has joined #ruby
[23:41:36] al2o3-cr: RickHull: 0 or raises
[23:41:52] RickHull: my code is "wrong" then
[23:42:09] jdawgaz: has joined #ruby
[23:42:23] RickHull: but still consider how I am doing the error handling before getting into the mkfifo and open bits
[23:42:37] RickHull: you should just have 2 file representations: a path, and a handle
[23:42:59] jdawgaz: has joined #ruby
[23:43:09] RickHull: make sure your path doesn't exist or if it does, it's a pipe. in that case, you probably don't want to call mkfifo on it, not sure
[23:43:26] RickHull: then file_handle = File.open(path, flag)
[23:43:30] RickHull: and go from there
[23:43:33] RickHull: i'm out, cheers
[23:43:44] jdawgaz: has joined #ruby
[23:44:12] ResidentBiscuit: has joined #ruby
[23:44:34] jdawgaz: has joined #ruby
[23:45:20] jdawgaz: has joined #ruby
[23:46:10] jdawgaz: has joined #ruby
[23:47:00] jdawgaz: has joined #ruby
[23:47:45] jdawgaz: has joined #ruby
[23:48:35] jdawgaz: has joined #ruby
[23:49:20] jdawgaz: has joined #ruby
[23:49:40] c-c: hehe I made it succinct https://gist.github.com/csmr/c6f7d9e4da7313d60845e5996130beb6
[23:51:48] guacamole: has joined #ruby
[23:55:06] Radar: I've got a class called "Transactions" which subclasses from array. I want to do chainable filtering on instances of this class, so here's what I've done to accomplish that: https://github.com/radar/moolah/blob/master/lib/moolah/transactions.rb#L20-L32. Is there a cleaner way?
[23:55:34] Radar: This means I can do transactions.between(start, finish).amount { |a| a > 100 }
[23:57:05] ahoyhere2: has joined #ruby
[23:57:18] devn: baweaver: RE: set_trace_func from earlier, how would you go about jacking into overriding the seed?
[23:57:51] ahoyhere2: has joined #ruby