« Back to channel list

#ruby - 16 April 2018

« Back 1 day Forward 1 day »
[00:03:39] felipe1: has joined #ruby
[00:06:05] schneider: has joined #ruby
[00:06:59] ResidentBiscuit: has joined #ruby
[00:11:55] ciscam: has joined #ruby
[00:15:12] schneider: has joined #ruby
[00:24:19] schneider: has joined #ruby
[00:25:18] erlend: has joined #ruby
[00:28:58] Synthead: has joined #ruby
[00:33:30] schneider: has joined #ruby
[00:36:46] chouhoulis: has joined #ruby
[00:42:40] schneider: has joined #ruby
[00:51:45] schneider: has joined #ruby
[00:52:25] minimalism: has joined #ruby
[00:56:15] noobineer: has joined #ruby
[00:56:29] yxhuvud: has joined #ruby
[01:00:50] schneider: has joined #ruby
[01:05:01] alfiemax: has joined #ruby
[01:10:05] schneider: has joined #ruby
[01:10:54] noobineer: has joined #ruby
[01:12:01] nadir: has joined #ruby
[01:15:00] zacts: has joined #ruby
[01:19:10] schneider: has joined #ruby
[01:26:07] bmurt: has joined #ruby
[01:28:16] schneider: has joined #ruby
[01:32:39] yxhuvud: has joined #ruby
[01:34:06] sameerynho: has joined #ruby
[01:34:20] bmurt: has joined #ruby
[01:37:10] roshanavand: has joined #ruby
[01:37:23] schneider: has joined #ruby
[01:37:48] kurko_: has joined #ruby
[01:39:40] alfiemax: has joined #ruby
[01:46:35] schneider: has joined #ruby
[01:49:53] dinfuehr_: has joined #ruby
[01:50:58] konsolebox: has joined #ruby
[01:55:18] lelliott: has joined #ruby
[01:55:42] schneider: has joined #ruby
[02:00:44] Yzguy: has joined #ruby
[02:01:31] alfiemax: has joined #ruby
[02:04:49] schneider: has joined #ruby
[02:12:32] rfoust: has joined #ruby
[02:13:54] schneider: has joined #ruby
[02:19:27] roshanavand: has joined #ruby
[02:21:55] fiachetti: has joined #ruby
[02:23:07] schneider: has joined #ruby
[02:23:18] roshanavand: has joined #ruby
[02:23:28] ciscam: has joined #ruby
[02:26:58] roshanavand: has joined #ruby
[02:28:52] roshanavand: has joined #ruby
[02:32:14] schneider: has joined #ruby
[02:32:33] alfiemax: has joined #ruby
[02:33:03] shinnya: has joined #ruby
[02:33:19] roshanavand: has joined #ruby
[02:34:04] erlend: has joined #ruby
[02:36:34] roshanavand: has joined #ruby
[02:37:07] bmurt: has joined #ruby
[02:38:02] duderonomy: has joined #ruby
[02:40:25] mjolnird: has joined #ruby
[02:41:23] schneider: has joined #ruby
[02:43:18] shinnya: has joined #ruby
[02:44:00] roshanavand: has joined #ruby
[02:49:14] Yzguy: has joined #ruby
[02:50:27] schneider: has joined #ruby
[02:57:31] Puppet`: has joined #ruby
[02:59:40] schneider: has joined #ruby
[03:00:13] cadillac_: has joined #ruby
[03:00:33] raynold: has joined #ruby
[03:05:29] Dimik: has joined #ruby
[03:08:45] schneider: has joined #ruby
[03:17:55] schneider: has joined #ruby
[03:19:33] gix-: has joined #ruby
[03:23:30] segy: has joined #ruby
[03:27:02] schneider: has joined #ruby
[03:28:49] yxhuvud: has joined #ruby
[03:29:35] skweek: has joined #ruby
[03:35:34] neohunter: has joined #ruby
[03:36:07] schneider: has joined #ruby
[03:37:30] neohunter: i wanto to be able to access a nested hash with a dot notation like my_hash['this.is.nested']
[03:37:46] neohunter: I'm trying without success to write the def [](key) method without success
[03:37:57] baweaver: Oh hey, I just wrote something like that
[03:37:59] havenwood: neohunter: are you familiar with the #dig method?
[03:38:03] baweaver: Though you could totally dig
[03:38:28] baweaver: nested_hash.dig(*'a.b.c.d'.split('.'))
[03:38:35] neohunter: ruby 2.2 :(
[03:38:49] neohunter: I think dig was introduced in 2.3
[03:38:56] arescorpio: has joined #ruby
[03:39:17] baweaver: Qo uses dig, so no dice there.
[03:41:30] baweaver: >> def dig(dot_path, hash) dot_path.split('.').reduce(hash) { |h, s| h && h[s] } end; dig('a'.b.c, {'a'=>{'b'=>{'c'=>1}}})
[03:41:31] ruby[bot]: baweaver: # => undefined method `c' for "a":String (NoMethodError) ...check link for more (https://eval.in/988713)
[03:41:40] Dimik: has joined #ruby
[03:43:16] baweaver: >> def dig(dot_path, hash) dot_path.split('.').reduce(hash) { |h, s| h && h[s] } end; dig('a.b.c', {'a'=>{'b'=>{'c'=>1}}})
[03:43:17] ruby[bot]: baweaver: # => 1 (https://eval.in/988715)
[03:43:30] baweaver: >> def dig(dot_path, hash) dot_path.split('.').reduce(hash) { |h, s| h && h[s] } end; dig('a.nope.c.d', {'a'=>{'b'=>{'c'=>1}}})
[03:43:31] ruby[bot]: baweaver: # => nil (https://eval.in/988716)
[03:44:23] eckhardt: has joined #ruby
[03:44:31] baweaver: you could also break early: dot_path.split('.').reduce(hash) { |h, s| break nil unless h[s]; h[s] }
[03:44:47] baweaver: though that's not _really_ that big of a deal
[03:45:17] schneider: has joined #ruby
[03:46:20] baweaver: Qo 0.2.0 released - https://github.com/baweaver/qo
[03:46:38] baweaver: Some fairly significant API lifts and restructuring on it - https://github.com/baweaver/qo/commit/54ed4780a33aa8dd853a62ed8df82f9fbcaf1f7b
[03:48:05] minimalism: has joined #ruby
[03:49:14] yxhuvud: has joined #ruby
[03:49:24] baweaver: Should probably rework dig a bit
[03:51:20] baweaver: The pains of agreeing on a public API for a gem, heh.
[03:54:26] schneider: has joined #ruby
[03:56:41] alfiemax: has joined #ruby
[03:57:14] yxhuvud: has joined #ruby
[04:00:03] baweaver: havenwood: What if I did this? Qo.matcher(Qo.ok { |good_result| ... }, Qo.error { |bad_result| ... })
[04:01:17] baweaver: Could probably also make it: Qo.error(:missing_param), Qo.error(:404), ...
[04:01:56] baweaver: banisterfiend ^ That look sane?
[04:02:17] baweaver: Reading through dry-matcher ( http://dry-rb.org/gems/dry-matcher/ ) and Elixir, borrowing some ideas
[04:02:25] baweaver: Most of my current implementation is super Scala-like
[04:03:29] schneider: has joined #ruby
[04:03:41] baweaver: Y'know, why not. I can just inherit from GuardBlockMatcher to make an Either style handler ala Haskell / Elixir
[04:03:50] baweaver: Gimme an hour or two
[04:03:55] baweaver: ACTION looks at clock
[04:04:00] baweaver: actually, back home first
[04:12:41] schneider: has joined #ruby
[04:21:48] schneider: has joined #ruby
[04:30:55] schneider: has joined #ruby
[04:31:21] baweaver: #yield_self
[04:40:07] schneider: has joined #ruby
[04:42:15] erlend: has joined #ruby
[04:45:21] venmx: has joined #ruby
[04:45:25] baweaver: havenwood: https://twitter.com/keystonelemur/status/985740828491395072
[04:45:28] baweaver: Now that's nice.
[04:49:14] schneider: has joined #ruby
[04:56:37] hkais: has joined #ruby
[04:58:23] schneider: has joined #ruby
[05:00:37] mynameisdebian: has joined #ruby
[05:01:51] comet23: You're nice
[05:07:29] schneider: has joined #ruby
[05:08:28] aufi: has joined #ruby
[05:11:54] hfp_work: has joined #ruby
[05:12:42] mikhael_k33hl: has joined #ruby
[05:13:21] mikhael_k33hl: Am I implementing the product-consumer design pattern correctly in this ruby code? https://gist.github.com/marzdgzmn/8b5a9e996e814051d508a50bba5b31eb
[05:13:53] baweaver: might want to name the file .rb
[05:15:57] reber: has joined #ruby
[05:16:04] baweaver: The question isn't implementation necessarily
[05:16:17] mikhael_k33hl: Sorry about that, https://gist.github.com/marzdgzmn/8b5a9e996e814051d508a50bba5b31eb
[05:16:24] baweaver: It's more of what the task is you're trying to achieve and if this explicitly makes sense for it
[05:16:39] schneider: has joined #ruby
[05:17:19] mikhael_k33hl: baweaver: Oh, trying to do parallel IO tasks, 10 rsyncs at a time :)
[05:18:18] alfiemax: has joined #ruby
[05:18:28] baweaver: might want to get your editor to use consistent tabs or spaces later too
[05:19:01] baweaver: but the pattern looks sane enough
[05:19:23] baweaver: Rubywise though....
[05:19:54] baweaver: `none?` is substantially faster than `select { ... }.size == 0`
[05:21:42] baweaver: The predicate `any?`, `all?`, and `none?` style methods are substantially faster than both `select` and `find`
[05:22:02] baweaver: and `count` is faster if you just want the size of matching elements
[05:22:04] mikhael_k33hl: baweaver: thanks, I'll try using that instead
[05:24:18] baweaver: The explicit false checks are odd
[05:25:24] sidx64: has joined #ruby
[05:25:45] Drakevr: has joined #ruby
[05:25:45] schneider: has joined #ruby
[05:25:47] baweaver: I'd also pull that block into a named method somewhere
[05:26:28] baweaver: def unfinished?(thread) thread.nil? || !thread.status || !thread['finished'].nil? end
[05:27:02] baweaver: gives it a nice clear name that conveys more meaning from a glance
[05:29:24] baweaver: https://gist.github.com/marzdgzmn/8b5a9e996e814051d508a50bba5b31eb?ts=2#gistcomment-2556277
[05:30:22] baweaver: Work on being more consistent with your indentation too. There were blocks that were fairly far out. Definitely avoid the Python hanging indent too, it's hard to maintain and a pain to read
[05:31:25] baweaver: Later I might consider abstracting methods out of that run loop to make them easier to test and document
[05:33:28] mikhael_k33hl: baweaver: thanks mate, I'll look into it
[05:34:52] schneider: has joined #ruby
[05:39:43] dminuoso: thread&.status || thread&.[]('finished')
[05:41:24] aupadhye: has joined #ruby
[05:41:24] aupadhye_: has joined #ruby
[05:41:37] schneider: has joined #ruby
[05:44:19] aupadhye: has joined #ruby
[05:46:33] darkhanb: has joined #ruby
[05:46:49] Yzguy: has joined #ruby
[05:49:51] jamesaxl: has joined #ruby
[05:50:52] schneider: has joined #ruby
[05:51:34] nowhere_man: has joined #ruby
[05:55:18] Yzguy: has joined #ruby
[05:55:31] mtkd: has joined #ruby
[05:55:40] anisha: has joined #ruby
[05:59:31] eckhardt: has joined #ruby
[05:59:55] schneider: has joined #ruby
[06:09:04] schneider: has joined #ruby
[06:09:19] eckhardt_: has joined #ruby
[06:11:02] alex``: has joined #ruby
[06:12:17] rippa: has joined #ruby
[06:12:47] konsolebox: & was 2.3 right?
[06:14:01] konsolebox: looks like it: https://bugs.ruby-lang.org/issues/11537
[06:15:10] kies: has joined #ruby
[06:16:08] kapil___: has joined #ruby
[06:18:11] schneider: has joined #ruby
[06:22:56] venmx: has joined #ruby
[06:23:54] Xiti`: has joined #ruby
[06:27:19] schneider: has joined #ruby
[06:31:54] duderonomy: has joined #ruby
[06:32:39] burgestrand: has joined #ruby
[06:36:24] schneider: has joined #ruby
[06:40:05] sidx64_: has joined #ruby
[06:44:07] sidx64: has joined #ruby
[06:45:35] schneider: has joined #ruby
[06:51:03] erlend: has joined #ruby
[06:54:28] gs: has joined #ruby
[06:54:44] schneider: has joined #ruby
[06:55:15] red_menace: has joined #ruby
[06:55:26] red_menace: has left #ruby: ()
[06:56:52] suukim: has joined #ruby
[07:00:21] TomyWork: has joined #ruby
[07:03:41] alfiemax: has joined #ruby
[07:03:51] schneider: has joined #ruby
[07:04:27] amar: has joined #ruby
[07:05:55] dionysus69: has joined #ruby
[07:07:37] rabajaj: has joined #ruby
[07:13:01] schneider: has joined #ruby
[07:16:31] mikecmpbll: has joined #ruby
[07:22:09] schneider: has joined #ruby
[07:23:39] yohji: has joined #ruby
[07:24:53] jenrzzz: has joined #ruby
[07:24:56] jenrzzz: has joined #ruby
[07:25:41] clemens3_: has joined #ruby
[07:27:27] eckhardt: has joined #ruby
[07:31:17] schneider: has joined #ruby
[07:36:02] ltt: has joined #ruby
[07:39:10] vondruch: has joined #ruby
[07:39:24] claudiuinberlin: has joined #ruby
[07:40:22] schneider: has joined #ruby
[07:40:40] vondruch: has joined #ruby
[07:45:45] tomphp: has joined #ruby
[07:49:28] schneider: has joined #ruby
[07:54:12] madhatter: has joined #ruby
[07:55:11] dionysus69: has joined #ruby
[07:55:17] mikecmpbll: has joined #ruby
[07:58:36] schneider: has joined #ruby
[08:02:11] tomphp: has joined #ruby
[08:07:46] schneider: has joined #ruby
[08:11:55] ltt: has joined #ruby
[08:16:55] schneider: has joined #ruby
[08:17:43] yohji: has joined #ruby
[08:17:48] amar: has joined #ruby
[08:22:14] cadillac_: has joined #ruby
[08:23:53] amar: has joined #ruby
[08:24:00] venmx: has joined #ruby
[08:25:09] marr: has joined #ruby
[08:26:02] schneider: has joined #ruby
[08:26:57] phaul: has joined #ruby
[08:27:32] jenrzzz: has joined #ruby
[08:27:32] jenrzzz: has joined #ruby
[08:34:23] mikecmpb_: has joined #ruby
[08:35:12] schneider: has joined #ruby
[08:36:16] jenrzzz: has joined #ruby
[08:36:16] jenrzzz: has joined #ruby
[08:36:59] nowhere_man: has joined #ruby
[08:40:48] camilasan: has joined #ruby
[08:43:14] shtirlic: has joined #ruby
[08:44:21] schneider: has joined #ruby
[08:46:14] ciscam: has joined #ruby
[08:47:27] dmarcoux: has left #ruby: ("Leaving")
[08:49:34] jenrzzz: has joined #ruby
[08:49:35] jenrzzz: has joined #ruby
[08:49:58] catphish: has joined #ruby
[08:55:23] schneider: has joined #ruby
[08:59:43] Beams: has joined #ruby
[08:59:47] erlend: has joined #ruby
[09:02:03] reber: has joined #ruby
[09:02:15] jenrzzz: has joined #ruby
[09:04:27] schneider: has joined #ruby
[09:06:29] alfiemax: has joined #ruby
[09:12:24] ltt: has joined #ruby
[09:13:36] schneider: has joined #ruby
[09:14:07] ur5us: has joined #ruby
[09:15:46] jenrzzz: has joined #ruby
[09:15:46] jenrzzz: has joined #ruby
[09:22:20] the_drow: has joined #ruby
[09:22:46] schneider: has joined #ruby
[09:24:09] the_drow_: has joined #ruby
[09:24:31] jenrzzz: has joined #ruby
[09:24:31] jenrzzz: has joined #ruby
[09:25:12] rahul_bajaj: has joined #ruby
[09:25:25] alfiemax_: has joined #ruby
[09:26:10] \void: has joined #ruby
[09:27:37] rabajaj: has joined #ruby
[09:31:13] _aeris_: has joined #ruby
[09:31:31] shiroeni: has joined #ruby
[09:31:54] schneider: has joined #ruby
[09:35:40] bosser: has joined #ruby
[09:37:01] jenrzzz: has joined #ruby
[09:40:45] alex``: has joined #ruby
[09:41:00] schneider: has joined #ruby
[09:45:46] jenrzzz: has joined #ruby
[09:45:46] jenrzzz: has joined #ruby
[09:48:44] amar: has joined #ruby
[09:50:09] schneider: has joined #ruby
[09:50:48] guille-moe: has joined #ruby
[09:51:28] tvw: has joined #ruby
[09:53:55] banisterfiend: has joined #ruby
[09:59:20] schneider: has joined #ruby
[10:01:59] apeiros: has joined #ruby
[10:02:45] jenrzzz: has joined #ruby
[10:06:20] quobo: has joined #ruby
[10:07:42] venmx: has joined #ruby
[10:08:26] schneider: has joined #ruby
[10:09:05] law: has joined #ruby
[10:11:52] jenrzzz: has joined #ruby
[10:11:52] jenrzzz: has joined #ruby
[10:16:06] guille-moe: has joined #ruby
[10:17:31] schneider: has joined #ruby
[10:20:10] halt: has joined #ruby
[10:20:59] GodFather: has joined #ruby
[10:21:42] Charliebr73: has joined #ruby
[10:24:27] jenrzzz: has joined #ruby
[10:26:16] tomphp: has joined #ruby
[10:31:57] schneider: has joined #ruby
[10:32:16] tomphp: has joined #ruby
[10:33:45] rabajaj: has joined #ruby
[10:33:51] mikecmpbll: has joined #ruby
[10:35:27] amar_: has joined #ruby
[10:41:04] schneider: has joined #ruby
[10:46:35] kapil___: has joined #ruby
[10:49:40] jenrzzz: has joined #ruby
[10:49:40] jenrzzz: has joined #ruby
[10:50:11] schneider: has joined #ruby
[10:54:10] yohji: has joined #ruby
[10:54:20] AJA4350: has joined #ruby
[10:54:46] RougeR: has joined #ruby
[10:54:56] RougeR: has joined #ruby
[10:56:48] hkais: has joined #ruby
[10:58:14] kurko_: has joined #ruby
[10:58:45] jenrzzz: has joined #ruby
[10:58:51] Kedare: has joined #ruby
[11:03:55] burgestrand: has joined #ruby
[11:04:05] ellcs: has joined #ruby
[11:04:15] schneider: has joined #ruby
[11:04:51] karapetyan: has joined #ruby
[11:07:06] jenrzzz: has joined #ruby
[11:07:56] chmurifree: has joined #ruby
[11:08:32] erlend: has joined #ruby
[11:13:25] schneider: has joined #ruby
[11:15:19] macduck: has joined #ruby
[11:15:53] jenrzzz: has joined #ruby
[11:15:53] jenrzzz: has joined #ruby
[11:22:06] apparition: has joined #ruby
[11:22:32] schneider: has joined #ruby
[11:24:49] jinie: has joined #ruby
[11:25:36] nadir: has joined #ruby
[11:28:13] minimalism: has joined #ruby
[11:30:36] ltt: has joined #ruby
[11:31:39] schneider: has joined #ruby
[11:32:21] macduck: has joined #ruby
[11:33:42] cadillac_: has joined #ruby
[11:34:28] amatas: has joined #ruby
[11:36:29] jenrzzz: has joined #ruby
[11:36:50] noobineer: has joined #ruby
[11:37:38] amatas: has joined #ruby
[11:38:49] tomphp: has joined #ruby
[11:39:29] sidx64: has joined #ruby
[11:40:53] schneider: has joined #ruby
[11:41:40] John_Ivan: has joined #ruby
[11:43:08] amatas: has joined #ruby
[11:44:52] ldnunes: has joined #ruby
[11:45:08] jenrzzz: has joined #ruby
[11:46:24] karapetyan: has joined #ruby
[11:50:06] schneider: has joined #ruby
[11:50:42] Psybur: has joined #ruby
[11:54:00] jenrzzz: has joined #ruby
[11:54:00] jenrzzz: has joined #ruby
[11:59:10] schneider: has joined #ruby
[12:02:46] jenrzzz: has joined #ruby
[12:02:46] jenrzzz: has joined #ruby
[12:06:19] duderonomy: has joined #ruby
[12:06:48] Beams_: has joined #ruby
[12:08:20] schneider: has joined #ruby
[12:10:37] cabotto: has joined #ruby
[12:11:51] n13z: has joined #ruby
[12:14:31] darkhanb: has joined #ruby
[12:15:15] cadillac_: has joined #ruby
[12:16:10] ltt: has joined #ruby
[12:17:26] schneider: has joined #ruby
[12:18:10] despai: has joined #ruby
[12:19:18] mkaito: hey does anyone here use NixOS to write Ruby on? I keep running into issues with bundler.
[12:19:54] yohji: has joined #ruby
[12:20:28] roshanavand: has joined #ruby
[12:26:36] schneider: has joined #ruby
[12:27:22] rabajaj: has joined #ruby
[12:27:54] reber: has joined #ruby
[12:28:07] minimalism: has joined #ruby
[12:30:52] karapetyan: has joined #ruby
[12:35:44] jenrzzz: has joined #ruby
[12:35:44] jenrzzz: has joined #ruby
[12:35:44] schneider: has joined #ruby
[12:38:16] triston: has joined #ruby
[12:38:45] Cavallari: has joined #ruby
[12:42:59] suukim: has joined #ruby
[12:43:17] karapetyan: has joined #ruby
[12:43:22] Esa_: has joined #ruby
[12:43:42] the_drow__: has joined #ruby
[12:44:10] minimalism: has joined #ruby
[12:44:17] bmurt: has joined #ruby
[12:44:51] schneider: has joined #ruby
[12:49:16] jenrzzz: has joined #ruby
[12:50:27] skw: has joined #ruby
[12:51:54] darix: mkaito: your issues might not be nixos specific and if you showed error messages then people might actually be able to help you.
[12:52:10] the_drow_: has joined #ruby
[12:54:01] schneider: has joined #ruby
[12:55:05] workmad3: has joined #ruby
[12:55:10] sidx64: has joined #ruby
[12:55:19] darkhanb: has joined #ruby
[12:55:41] rabajaj: has joined #ruby
[12:56:04] skw: has joined #ruby
[12:56:28] rfoust: has joined #ruby
[12:56:42] the_drow__: has joined #ruby
[12:58:48] mkaito: oh they are. I encounter 2 different errors. One, bundler tries to write to the nix store, which is read-only. the other is that somewhere, bundler 1.16.1 gets activated, but the system version is 1.14.6, so it bails.
[13:02:18] duderonomy: has joined #ruby
[13:03:06] schneider: has joined #ruby
[13:05:10] konsolebox: mkaito: for your second problem, perhaps you need to set PATH to the path where bundler is installed as a gem in your user.
[13:05:24] jenrzzz: has joined #ruby
[13:05:52] konsolebox: mkaito: in my case i add `PATH+=:$(ruby -e 'puts Gem.bindir')` in .bashrc
[13:06:12] tcopeland: has joined #ruby
[13:06:25] karapetyan: has joined #ruby
[13:07:21] konsolebox: wait.. i think that should be the other way around: PATH=$(ruby -e 'puts Gem.bindir'):$PATH
[13:08:20] konsolebox: yes it should be the latter
[13:08:29] mkaito: that should actually be handled by Nix. That's kind of what it does.
[13:08:45] mkaito: ruby tooling on nixos is kind of in a bad shape anyway
[13:08:49] mkaito: not enough people working on it
[13:08:51] bmurt: has joined #ruby
[13:10:03] burgestrand: has joined #ruby
[13:10:27] mkaito: oh well, it's decided to work now. will probably break again in 5 minutes.
[13:12:14] schneider: has joined #ruby
[13:12:16] ltt: has joined #ruby
[13:14:00] jenrzzz: has joined #ruby
[13:14:00] jenrzzz: has joined #ruby
[13:14:58] darix: mkaito: my guess is that you have sudo rights and it tries to install gems into the system path
[13:15:19] phaul: has joined #ruby
[13:15:22] mkaito: nah, it's that the nix store is a RO mount.
[13:15:57] darix: mkaito: yes
[13:16:26] darix: but bundle install will only write there if it thinks it should install gems to system. e.g. when called with "bundle install --system"
[13:17:17] erlend: has joined #ruby
[13:17:24] mkaito: I've convinced it manually by setting GEM_HOME
[13:17:36] jeffreylevesque: has joined #ruby
[13:17:51] mkaito: it's just a little confusing sometimes... because it should all be handled by nix transparently.
[13:17:57] mkaito: sometimes it works, and then it decides it doesn't
[13:18:06] jokke: had the same experience
[13:18:21] jokke: i like the concept, but it turned out not to work in practice
[13:19:02] karapetyan: has joined #ruby
[13:19:13] mkaito: nix is an amazing thing. it's just that many assumptions made in ruby tooling don't mesh with nix at all.
[13:19:27] jokke: not only ruby
[13:19:34] mkaito: like the read-only nix store. try packaging something for nixos that assumes it can write to its installation folder. it's a nightmare.
[13:19:52] darix: mkaito: nothing should by default write to the installation folder.
[13:20:02] darix: that's what /var/lib is for
[13:20:10] mkaito: try deploying a servlet that assumes it can write to WEB-INF :P
[13:20:17] mkaito: the symlink soup was epic for that one
[13:20:20] darix: which is broken by design
[13:20:36] darix: I also hate that default permissions you see in many rails apps e.g.
[13:20:43] darix: where the app is owned by the runtime user,
[13:20:55] darix: for easier persistence when getting hacked, i guess.
[13:21:18] mkaito: or tmp/log folders in the app tree
[13:21:24] schneider: has joined #ruby
[13:21:35] darix: mkaito: but we normally dont load code from those directories.
[13:21:50] darix: while dropping a snippet into config/initializers/
[13:22:08] darix: or a new controller to reload my exploit after restart
[13:22:15] darix: different thing
[13:22:52] mkaito: well I recently packaged hubot for nix. FNAR it wanted to create and then immediately destroy a folder in the installation root. That's the kind of thing that takes a lot of `strace`, and then a lot of facepalming when trying to debug.
[13:23:45] karapetyan: has joined #ruby
[13:24:03] darix: mkaito: i fixed similar things for other tools.
[13:24:11] mkaito: now that I have something resembling a development environment working... it'll be twice the fun when packaging it for deployment.
[13:25:05] darix: maybe add a patch to configure the datadir :P
[13:25:29] mkaito: nah, we've decided to write our own little bot framework in Haskell
[13:25:34] mkaito: nobody wants to touch javascript here lol
[13:25:58] darix: between those 2 languages it is like pest vs cholera
[13:26:23] ellcs: has joined #ruby
[13:26:49] cabotto: has joined #ruby
[13:27:07] mkaito: well I work at a Haskell shop
[13:27:11] mkaito: I'm sure some of them can figure it out
[13:27:13] mkaito: I'm the devops :P
[13:27:18] darix: everyone does that mistake at times
[13:27:20] mkaito: I don't Haskell, I just run their stuff
[13:27:41] duderonomy: has joined #ruby
[13:28:23] darix: ACTION wonders if mkaito works for wireapp
[13:28:35] mkaito: no, but we just had someone leave there lol
[13:29:28] chouhoulis: has joined #ruby
[13:30:05] konsolebox: come to Gentoo. here, even 4 ruby versions can live happily ever after.
[13:30:19] darix: konsolebox: only 4? opensuse has 5! ;)
[13:30:21] karapetyan: has joined #ruby
[13:30:30] schneider: has joined #ruby
[13:30:35] darix: well for leap 15.0 i cut it down to 1: 2.5
[13:30:59] darix: and we have a decent way to repackage gems in rpms. which allows nice packaging of rails apps.
[13:31:12] darix: ACTION has a gitlab-ce and discourse rpm e.g.
[13:31:24] mkaito: I'll someday find time to work on the ruby tooling in NixOS, probably...
[13:31:39] mkaito: I just wanted to put up a quick proof of concept for something, and since I know ruby...
[13:31:42] mkaito: not been very successful so far lol
[13:31:50] jenrzzz: has joined #ruby
[13:32:13] dr3wo: has joined #ruby
[13:36:13] k0mpa: has joined #ruby
[13:39:01] macduck: has joined #ruby
[13:39:39] schneider: has joined #ruby
[13:43:10] banisterfiend: has joined #ruby
[13:45:54] burgestrand: has joined #ruby
[13:46:24] jenrzzz: has joined #ruby
[13:46:46] Kedare: has joined #ruby
[13:46:58] amar: has joined #ruby
[13:48:47] jerematic: has joined #ruby
[13:50:29] duderonomy: has joined #ruby
[13:50:40] schneider: has joined #ruby
[13:52:34] amatas: has joined #ruby
[13:55:56] amatas: has joined #ruby
[13:57:25] kurko__: has joined #ruby
[13:59:50] schneider: has joined #ruby
[14:00:20] Asher: has joined #ruby
[14:01:09] burgestrand: has joined #ruby
[14:03:25] amelliaa: has joined #ruby
[14:04:59] Beams: has joined #ruby
[14:06:35] Rapture: has joined #ruby
[14:08:59] schneider: has joined #ruby
[14:09:12] Asher: has joined #ruby
[14:09:29] pastorinni: has joined #ruby
[14:13:15] cschneid_: has joined #ruby
[14:13:58] tomphp: has joined #ruby
[14:18:10] schneider: has joined #ruby
[14:19:40] hammer: has joined #ruby
[14:20:10] Dimik: has joined #ruby
[14:20:14] gizmore: has joined #ruby
[14:21:24] karapetyan: has joined #ruby
[14:23:55] hammer8: has joined #ruby
[14:24:01] rfoust: has joined #ruby
[14:25:27] karapetyan: has joined #ruby
[14:25:58] tcopeland: has joined #ruby
[14:27:50] chouhoulis: has joined #ruby
[14:30:20] theRoUS: has joined #ruby
[14:30:39] theRoUS: has joined #ruby
[14:30:50] chouhoulis: has joined #ruby
[14:31:00] netherwolfe: has joined #ruby
[14:32:43] tomphp: has joined #ruby
[14:33:59] grilix: has joined #ruby
[14:36:30] banisterfiend: has joined #ruby
[14:37:51] Hanmac: has joined #ruby
[14:38:20] jud^: has joined #ruby
[14:38:54] oleo: has joined #ruby
[14:39:34] karapety_: has joined #ruby
[14:41:15] burgestrand: has joined #ruby
[14:42:32] jenrzzz: has joined #ruby
[14:42:32] jenrzzz: has joined #ruby
[14:43:36] dr3wo: has joined #ruby
[14:43:43] Sirecote: has joined #ruby
[14:44:30] Xiti: has joined #ruby
[14:51:19] duderonomy: has joined #ruby
[14:56:57] Mike11: has joined #ruby
[14:59:17] Beams: has joined #ruby
[15:02:13] guest56: has joined #ruby
[15:03:04] havenwood: guest__: hi
[15:03:15] guest56: hi havenwood
[15:03:30] stnly: has joined #ruby
[15:03:46] guest56: if I am not wrong, in this chat people are talking ruby? :)
[15:04:36] psychicist__: has joined #ruby
[15:05:04] apeiros: has joined #ruby
[15:07:05] Muz: has joined #ruby
[15:10:25] cyberg: has joined #ruby
[15:14:25] ltt: has joined #ruby
[15:16:03] theunraveler: has joined #ruby
[15:20:37] gizmore: this channel is about ruby, the movie?
[15:20:57] yohji: has joined #ruby
[15:22:15] headius: only if the movie is about ruby, the programming language
[15:22:53] jcarl43: has joined #ruby
[15:24:26] ellcs: has joined #ruby
[15:26:00] amar: has joined #ruby
[15:26:03] erlend: has joined #ruby
[15:28:57] apeiros: has joined #ruby
[15:29:17] vutral|kali: has joined #ruby
[15:29:29] vutral|kali: where does ruby look for classes ?
[15:29:55] dminuoso: vutral|kali: It checks the current nesting stack.
[15:30:12] dminuoso: vutral|kali: To see the current nesting stack, use `Module.nesting`
[15:30:38] dminuoso: vutral|kali: Ah actually Im tired to explain it. https://cirw.in/blog/constant-lookup.html
[15:31:59] dminuoso: vutral|kali: Note that it's not entirely up to date anymore.
[15:32:16] dminuoso: In 2.5 changes were made that, unless explicitly qualified with Object::, lookup stops at Object.
[15:32:55] dminuoso: Or something ah I dont know. Requires a PhD to understand fundamental Ruby basics.
[15:33:30] dminuoso: I wrote patches in that area, but forgot about it.
[15:35:46] troys: has joined #ruby
[15:40:41] konsolebox: has joined #ruby
[15:44:03] dr3wo: has joined #ruby
[15:47:03] karapetyan: has joined #ruby
[15:52:39] Yrie: has joined #ruby
[15:53:26] apeiros: poor lad, got sucked into the bottomless abyss of the irc
[15:56:45] kurko_: has joined #ruby
[15:59:13] psychicist__: has joined #ruby
[16:00:14] cagomez: has joined #ruby
[16:01:45] alex``: has joined #ruby
[16:02:25] marxarelli: has joined #ruby
[16:05:39] memo1: has joined #ruby
[16:07:59] Ryzokuken: has joined #ruby
[16:10:31] [Butch]: has joined #ruby
[16:11:38] memo1: hi, i need to get video from a video camera using ffmpeg. I already do the script, but went the camera is down, the scripts finish and dont start again. Any ideas to check connection and start the streaming again?
[16:12:37] GodFather: has joined #ruby
[16:12:49] darkhanb: has joined #ruby
[16:14:08] cschneid_: has joined #ruby
[16:14:28] amar: has joined #ruby
[16:14:37] cthulchu: has joined #ruby
[16:14:50] ltt: has joined #ruby
[16:15:41] jerematic: has joined #ruby
[16:17:20] jerematic: has joined #ruby
[16:18:03] amar: has joined #ruby
[16:23:28] GodFather_: has joined #ruby
[16:28:07] pabs: has joined #ruby
[16:32:03] gizmore: memo1: use a bash script in cronjob that launches the daemone every 2s with a lock
[16:32:19] gizmore: so you get down from 1minute cronjob to 2s
[16:32:54] gizmore: i know that is not state of the art maybe... but works and is easy :PO
[16:33:08] amar_: has joined #ruby
[16:34:16] dionysus69: has joined #ruby
[16:38:28] amatas: has joined #ruby
[16:39:18] vdl: hi folks
[16:40:00] vdl: why this works fine: http://ix.io/17Wo but this: http://ix.io/17Wp fails with undefined method `register' for main:Object (NoMethodError)?
[16:40:17] amatas: has joined #ruby
[16:40:21] vdl: ACTION prepares himself to feel stupid
[16:43:23] claudiuinberlin: has joined #ruby
[16:43:52] jamesaxl: has joined #ruby
[16:44:26] NL3limin4t0r_afk: nick /NL3limin4t0r
[16:44:38] millerti: has joined #ruby
[16:44:50] konsolebox: vdl: with `Asciidoctor::Extensions.register`, you're calling the singleton method of Asciidoctor::Extensions, where is with just 'register', you're calling an instance method of Object which was never there. when you executed include Asciidoctor::Extensions, you only "included" the module to the Object class. maybe you can extend, but i'm not sure if that's a good idea. why not just stick with the first method?
[16:47:35] havenwood: vdl: If they would have used module_function it would behave as you expect, but they used `class << self`.
[16:48:05] alfiemax: has joined #ruby
[16:48:27] havenwood: vdl: https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/extensions.rb#L1373
[16:48:39] havenwood: https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/extensions.rb#L1431-L1446
[16:48:55] jerematic: has joined #ruby
[16:49:10] vdl: konsolebox: I will stick with the first version, I was just curious why what seemed intuitive to me didn't work
[16:49:35] vdl: havenwood: would module_function be prefered here or `class << self` is legit?
[16:49:47] havenwood: vdl: I think what you expected is reasonable, and it's why module_function is nice.
[16:50:23] konsolebox: vdl: because it's not like a namespace in c++ than you can just "use". extending and including changes context or receiver.
[16:50:46] havenwood: vdl: It's a fairly minor point, but i'd prefer it to work as you expected. Much of the stdlib uses module_function, so we get used to it working like that.
[16:50:55] sanscoeur: has joined #ruby
[16:51:12] havenwood: Many would argue that module_function is idiomatic.
[16:51:14] havenwood: I do like it.
[16:52:15] vdl: I'll propose a patch, we'll see what they think
[16:52:34] vdl: havenwood: would changing it for a module_function have side effect?
[16:57:10] NL3limin4t0r: vdl: If you change an singleton method to an instance method all method calls made become invalid since they are not made in the right context and have to prefixed with the singleton class.
[16:58:53] NL3limin4t0r: eg. `generate_name` would become `Extensions.generate_name`
[16:59:26] ltt: has joined #ruby
[16:59:28] vdl: ok I see
[16:59:37] tomphp: has joined #ruby
[16:59:47] vdl: I'll fill an issue instead and see how it goes
[17:00:16] NL3limin4t0r: if you're working with classes you can also use `self.class.method_name` but this doesn't work for modules.
[17:00:38] hahuang65: has joined #ruby
[17:02:16] NL3limin4t0r: One of the reasons to use singleton methods in modules is to avoid cluttering the class/module that includes them.
[17:04:21] NL3limin4t0r: Than only expose the methods via instance methods that the user is to supposed to interface with.
[17:04:43] memo1: gizmore: thank you, dont understat the "lock" part, how i do that?
[17:04:52] d5sx43: has joined #ruby
[17:07:16] gizmore: memo1: a lock is ensuring only one program at a time can access something
[17:07:24] konsolebox: havenwood: your idea seems to be similar to `module X; def something; end; extend self; end` but that may not always work since a singleton method like register may be designed to only work for its owner.
[17:08:59] konsolebox: furthermore, generally including a module to Object could be disastrous.
[17:09:16] vdl: issue created, thanks
[17:09:51] apeiros: konsolebox: that's where module_function is better than extend self
[17:09:58] apeiros: see e.g. Math and Kernel
[17:10:05] apeiros: all methods there are module_function
[17:10:28] apeiros: Kernel is included in Object, and it's not really a problem to include Math
[17:10:43] apeiros: mainly because module_function turns instance methods private (which makes sense)
[17:11:00] konsolebox: that difference is just about being selective, but it doesn't change the idea
[17:11:31] apeiros: that's rather hand-waving something substantial ;-)
[17:11:43] apeiros: "1'000'000 is just a 1 with a couple of zeroes"
[17:14:10] d5sx43_: has joined #ruby
[17:14:12] amar: has joined #ruby
[17:14:27] amar: has joined #ruby
[17:15:02] Eiam: has joined #ruby
[17:15:21] Asher: has joined #ruby
[17:17:21] d5sx43_: has joined #ruby
[17:17:45] jenrzzz: has joined #ruby
[17:17:45] jenrzzz: has joined #ruby
[17:19:31] mtkd: has joined #ruby
[17:26:45] alfiemax_: has joined #ruby
[17:28:01] konsolebox: apeiros: fair enough. i get the idea about methods being made private. i still wouldn't include a special module like that even if that is the case. the private methods can still be in danger of being shadowed.
[17:28:16] apeiros: eh, me neither
[17:28:25] apeiros: I try to avoid both, extend self and module_function
[17:28:50] apeiros: but if the rare case occurs that I want to be able to both include and call on the module directly, I use module_function over extend self
[17:28:59] konsolebox: same as well
[17:29:07] konsolebox: oh wait.. maybe
[17:34:17] erlend: has joined #ruby
[17:36:44] kapil___: can i write `datastream.scan(/(.*\#{word}(.*?\r?\n?)*\#{word})/)`
[17:36:55] kapil___: #{word} is variable?
[17:38:50] Eiam: kapil___: Regexp.quote(variable)
[17:39:05] Eiam: inside your #{}
[17:39:41] Eiam: kapil___: https://ruby-doc.org/core-2.2.0/Regexp.html#method-c-quote
[17:39:49] kapil___: Eiam: thanks
[17:40:07] Eiam: it explains why thats important/useful, no need for me to repeat whats alread ywritten
[17:41:40] eckhardt: has joined #ruby
[17:45:10] kapil___: `/(.*\#{Regexp.quote(word)}(.*?\r?\n?)*\#{Regexp.quote(word)})/` not working
[17:46:16] havenwood: kapil___: Don't escape the # in #{}.
[17:46:29] havenwood: kapil___: Remove the backwhacks from: \#{
[17:48:47] kapil___: `/(.*\#Regexp.quote(word)(.*?\r?\n?)*\#Regexp.quote(word))/` not works too
[17:49:08] havenwood: kapil___: You're still escaping the #{}s.
[17:49:35] havenwood: kapil___: You removed the { when you should have removed the \
[17:49:53] havenwood: kapil___: #{} <- this
[17:49:54] havenwood: kapil___: \#{} <- not this
[17:50:54] kapil___: `/(.*#{Regexp.quote(word)}(.*?\r?\n?)*#{Regexp.quote(word)})/` works. thanks
[17:52:26] cliluw: has joined #ruby
[17:54:03] harrycs: has joined #ruby
[17:54:47] Eiam: kapil___: Just to make sure you understand whats going on, \ is an escape character inside of a regexp, so when you do \# you are telling regex to look explicitly for "#". Regexp.quote takes the string passed to it and looks for characters that should be escaped and adds \ for you, so "." becomes "\." since "." has a special meaning in regexp
[17:55:37] kapil___: Eiam: thanks a lot.
[17:55:45] Eiam: mm hmm, may you catch many fish
[17:55:49] harrycs: ^ I like using rubular.com for regex stuff
[17:55:54] kapil___: but this function stopped working `datastream.scan(/(.*#{Regexp.quote(word)}(.*?\r?\n?)*#{Regexp.quote(word)})/).last`
[17:56:13] Eiam: I suggets using Rubular as well
[17:56:34] Eiam: I write all my regex in it so I can see how all the test cases pan out as various inputs
[17:57:06] Eiam: Not interested in reversing the goal of your regex, its write once read never code.
[17:57:39] kapil___: Eiam: thanks
[17:57:41] Eiam: Build it in Rubular and see why its not working. BRB OS update.
[17:58:11] kapil___: if i not use Regexp.quote it woks
[17:58:43] alfiemax: has joined #ruby
[17:59:41] alfiemax: has joined #ruby
[18:01:48] apeiros: kapil___: note that /.*?\r?\n?/ will happily match an empty string
[18:02:11] kapil___: apeiros: yes
[18:02:43] kapil___: but why it not working
[18:03:28] kapil___: word = "# Part7A"
[18:09:10] NL3limin4t0r: >> "Hello\r\nWorld!".match? /\A.*\z/
[18:09:11] ruby[bot]: NL3limin4t0r: # => undefined method `match?' for "Hello\r\nWorld!":String ...check link for more (https://eval.in/989109)
[18:11:51] karapetyan: has joined #ruby
[18:19:25] orbyt_: has joined #ruby
[18:20:41] ramfjord: has joined #ruby
[18:21:05] kapil___: it works now thanks
[18:21:52] havenwood: NL3limin4t0r: we need to update the bot's Ruby version
[18:23:03] Cthulu201: has joined #ruby
[18:23:22] NL3limin4t0r: havenwood: I didn't knew #match? wasn't in 2.3, it feels like it's in forever.
[18:24:55] NL3limin4t0r: kapil___: You can use the 'm' modifier to also match newline characters.
[18:25:33] NL3limin4t0r: >> "Hello\r\nWorld!".match(/\A.*\z/)
[18:25:35] ruby[bot]: NL3limin4t0r: # => nil (https://eval.in/989122)
[18:25:40] NL3limin4t0r: >> "Hello\r\nWorld!".match(/\A.*\z/m)
[18:25:41] ruby[bot]: NL3limin4t0r: # => #<MatchData "Hello\r\nWorld!"> (https://eval.in/989123)
[18:26:39] kapil___: NL3limin4t0r: what the above functions matches?
[18:29:03] banisterfiend: has joined #ruby
[18:30:46] hkais: has joined #ruby
[18:30:53] Eiam: has joined #ruby
[18:31:05] NL3limin4t0r: kapil___: You use `(.*?\r?\n?)*` in your regex, you can also use the 'm' modifier in it's place and replace the part with `(?m:.*?)` or add the 'm' behind the regex `/regex/m` if you want all dots to match newlines.
[18:36:12] GodFather_: has joined #ruby
[18:36:33] sameerynho: has joined #ruby
[18:37:51] jenrzzz: has joined #ruby
[18:37:51] jenrzzz: has joined #ruby
[18:40:20] imode: has joined #ruby
[18:41:19] despai: has joined #ruby
[18:42:03] chouhoul_: has joined #ruby
[18:42:48] karapetyan: has joined #ruby
[18:49:38] n0m4d1c: has joined #ruby
[18:52:54] kspencer-: has joined #ruby
[18:56:44] chouhoulis: has joined #ruby
[18:57:50] kspencer: I have code where a webhook receiver is catching x-gitlab-event, x-github-event, and x-gogs-event, and to differentiate and be 'error-proof' I want to make sure only one of them ever returns anything other than nil, basically making them 'there can only be one', if x-github-event and x-gitlab-event exist, then the request should 400 telling the user there is more than one event defined
[18:58:31] kspencer: the goes for any combination of the three
[18:59:45] orbyt_: has joined #ruby
[19:01:22] duderonomy: has joined #ruby
[19:02:38] schneider: has joined #ruby
[19:02:41] darkhanb: has joined #ruby
[19:02:57] kspencer: https://github.com/IotaSpencer/site_hook/blob/dev/lib/site_hook.rb#L106-L181
[19:04:51] clemens3_: has joined #ruby
[19:05:39] venmx: has joined #ruby
[19:08:40] jenrzzz: has joined #ruby
[19:08:40] jenrzzz: has joined #ruby
[19:09:28] dr3wo: has joined #ruby
[19:09:34] chouhoulis: has joined #ruby
[19:11:58] schneider: has joined #ruby
[19:15:59] SeepingN: has joined #ruby
[19:16:29] tAn: has joined #ruby
[19:21:04] tomphp: has joined #ruby
[19:21:16] schneider: has joined #ruby
[19:30:13] bmurt: has joined #ruby
[19:30:36] schneider: has joined #ruby
[19:31:28] bmurt: has joined #ruby
[19:37:16] schneider: has joined #ruby
[19:43:01] skw: has joined #ruby
[19:44:01] GodFather: has joined #ruby
[19:47:53] workmad3: has joined #ruby
[19:49:25] mtkd: has joined #ruby
[20:00:42] jenrzzz_: has joined #ruby
[20:00:54] tcopeland: has joined #ruby
[20:01:36] schneider: has joined #ruby
[20:02:51] Apocalypse: has joined #ruby
[20:02:58] sanscoeur: has joined #ruby
[20:03:26] chouhoul_: has joined #ruby
[20:09:13] Sembei: has joined #ruby
[20:09:33] chouhoulis: has joined #ruby
[20:10:06] orbyt_: has joined #ruby
[20:10:57] gigetoo: has joined #ruby
[20:14:52] n008f4g_: has joined #ruby
[20:16:09] GodFather: has joined #ruby
[20:19:40] eckhardt: has joined #ruby
[20:20:18] graft: has joined #ruby
[20:20:18] dr3wo: has joined #ruby
[20:20:18] graft: has joined #ruby
[20:22:17] weaksauce: has joined #ruby
[20:29:55] AJA4350: has joined #ruby
[20:32:56] pabloh: has joined #ruby
[20:34:02] tAn: has joined #ruby
[20:38:54] pastorinni: has joined #ruby
[20:43:08] erlend: has joined #ruby
[20:45:48] memo1: has joined #ruby
[20:49:50] ramfjord: has joined #ruby
[20:55:48] ramfjord: has joined #ruby
[20:58:35] eckhardt: has joined #ruby
[21:01:23] tomphp: has joined #ruby
[21:02:55] postmodern: has joined #ruby
[21:03:11] mkaito: has joined #ruby
[21:03:12] mkaito: has joined #ruby
[21:03:17] ramfjord: has joined #ruby
[21:03:54] GodFather: has joined #ruby
[21:07:01] roshanavand: has joined #ruby
[21:09:11] ramfjord: has joined #ruby
[21:09:40] hays_: has joined #ruby
[21:09:41] hays_: has joined #ruby
[21:12:35] sanscoeur: has joined #ruby
[21:15:17] ramfjord: has joined #ruby
[21:26:40] chouhoul_: has joined #ruby
[21:27:57] chouhoul_: has joined #ruby
[21:32:10] ramfjord: has joined #ruby
[21:34:45] lxsameer: has joined #ruby
[21:36:59] pilne: has joined #ruby
[21:41:54] orbyt_: has joined #ruby
[21:42:02] kspencer: I kinda figured it out, using Enumerable.one?
[21:45:08] ramfjord: has joined #ruby
[21:47:07] workmad3: has joined #ruby
[21:47:12] pastorin_: has joined #ruby
[21:49:42] banisterfiend: has joined #ruby
[21:50:56] ramfjord: has joined #ruby
[21:51:17] ur5us: has joined #ruby
[21:54:09] ur5us_: has joined #ruby
[21:54:13] tomphp: has joined #ruby
[21:57:08] samort7: has joined #ruby
[21:57:39] ramfjord: has joined #ruby
[21:58:20] havenwood: kspencer: There was a proposal for #Enumerable#single: https://bugs.ruby-lang.org/issues/13683
[21:58:53] havenwood: kspencer: If that would be useful for you, I'd suggest weighing in on that issue. (And if you really want it to be merged, also propose a better name.)
[21:59:05] karapetyan: has joined #ruby
[21:59:26] nowhere_man: has joined #ruby
[21:59:38] roshanavand: has joined #ruby
[22:01:45] memo1: has joined #ruby
[22:03:40] Psybur: has joined #ruby
[22:04:05] ptr4ce: has joined #ruby
[22:05:07] n0m4d1c: has joined #ruby
[22:05:50] nowhere_man: has joined #ruby
[22:06:08] icarus: has joined #ruby
[22:06:13] ur5us: has joined #ruby
[22:06:33] banisterfiend: has joined #ruby
[22:07:46] chouhoulis: has joined #ruby
[22:08:01] ramfjord: has joined #ruby
[22:13:54] ramfjord: has joined #ruby
[22:16:05] ur5us_: has joined #ruby
[22:16:21] mikecmpbll: has joined #ruby
[22:19:56] ramfjord: has joined #ruby
[22:25:31] ramfjord: has joined #ruby
[22:28:25] hammer: has joined #ruby
[22:28:58] roshanavand: what's the simples pure Ruby way to run two transactions in parallel at the same time
[22:29:35] roshanavand: by pure Ruby I mean avoid using external gems
[22:31:50] Eiam: ruby has threads
[22:31:59] Psybur: has joined #ruby
[22:32:02] Eiam: Thread.new
[22:32:43] Eiam: roshanavand: https://ruby-doc.org/core-2.2.0/Thread.html
[22:33:05] havenwood: roshanavand: When you say transactions, what do you mean?
[22:33:36] roshanavand: havenwood: Here I meant db transactions
[22:33:54] Eiam: oh... Sequel has support for transactions and concurrency but its an external gem...
[22:34:06] Eiam: does Ruby by default support databases? I don't think so...
[22:34:15] Eiam: i mean, its code, you can build the support yourself ;)
[22:34:20] havenwood: Eiam: It does! (DBM.) ¯\_(ツ)_/¯
[22:34:23] banisterfiend: has joined #ruby
[22:34:28] hammer: has joined #ruby
[22:34:44] Eiam: havenwood: ha, totally missed that. I use Sequel cause its so good
[22:35:05] havenwood: Eiam: +1 Sequel
[22:35:22] eckhardt: has joined #ruby
[22:35:22] Eiam: and glancing at the DBM documentation, transactions and concurrency lolll
[22:35:30] venmx: has joined #ruby
[22:35:34] roshanavand: does using thread mean that they'll both be running at the same instant
[22:35:37] havenwood: Eiam: Ruby stdlib has DBM, GDBM, SDBM and YAML::DBM.
[22:35:50] Eiam: roshanavand: uhmm
[22:35:58] Eiam: I'm already concerned about whatever you are trying to do
[22:35:59] havenwood: The only one I ever use is YAML::DBM.
[22:36:35] havenwood: roshanavand: Threads let go of the global vm lock when they do IO.
[22:36:39] Eiam: roshanavand: nothing on the computer is running at the same instant
[22:36:46] havenwood: roshanavand: On JRuby there is no GVL.
[22:37:05] havenwood: roshanavand: Say more about what you're doing and why?
[22:37:32] havenwood: roshanavand: Do you already have a DB? What DB is it? Using any gems with it?
[22:38:00] roshanavand: hmm, I'm trying to test a split brain situation
[22:38:20] havenwood: On a specific DB?
[22:38:41] havenwood: roshanavand: Using default ActiveRecord?
[22:40:12] havenwood: roshanavand: And you're trying to establish a test? Or?
[22:40:23] havenwood: roshanavand: Using RSpec or Minitest or?
[22:40:53] Eiam: avoid using external gems, already using activerecord & Rails
[22:41:00] Eiam: ACTION facepalms
[22:41:27] Azure: has joined #ruby
[22:41:32] roshanavand: OK, sorry, let me ask a better question
[22:41:32] roshanavand: Using Rails, PG and RSpec, how would you test an advisory lock for avoiding split brain situations
[22:41:39] roshanavand: I hope this was better saying
[22:44:35] zapata: has joined #ruby
[22:46:10] kspencer: havenwood: https://bugs.ruby-lang.org/issues/13683#note-11
[22:46:29] havenwood: kspencer: +1
[22:46:36] havenwood: roshanavand: Yes, that's much better.
[22:47:33] havenwood: roshanavand: I'd suggest asking in #RubyOnRails. You might also check if there's an existing test along those lines. Sometimes we get tempted to test what Rails is already testing.
[22:47:44] havenwood: roshanavand: https://github.com/rails/rails/tree/master/activerecord/test/cases
[22:49:27] cschneid_: has joined #ruby
[22:49:36] Azure|dc: has joined #ruby
[22:50:23] Isa_: has joined #ruby
[22:50:31] cschneid_: has joined #ruby
[22:50:35] havenwood: roshanavand: Keep in mind that there're implicit transactions around your tests: https://relishapp.com/rspec/rspec-rails/docs/transactions
[22:50:47] havenwood: roshanavand: http://pawelgoscicki.com/archives/2015/09/testing-database-transactions-explicitly-in-rspec/
[22:51:22] erlend: has joined #ruby
[22:51:26] roshanavand: useful info, thanks
[22:52:38] tomphp: has joined #ruby
[22:53:29] tomphp: has joined #ruby
[22:54:14] tomphp: has joined #ruby
[22:58:51] eckhardt: has joined #ruby
[22:59:17] nowhere_man: has joined #ruby
[23:00:48] cadillac_: has joined #ruby
[23:04:02] ellcs: has joined #ruby
[23:07:33] jeffreylevesque: has joined #ruby
[23:10:17] netherwolfe_: has joined #ruby
[23:12:22] netherwolfe__: has joined #ruby
[23:13:08] tcopeland: has joined #ruby
[23:13:57] orbyt_: has joined #ruby
[23:17:49] ResidentBiscuit: has joined #ruby
[23:20:42] ramfjord: has joined #ruby
[23:21:40] jenrzzz_: roshanavand: here's an example of how you might test advisory locking with threads in rspec: https://gist.github.pie.apple.com/jenner/7dcd287f13739e63fd4379301cdb73e3
[23:22:16] jenrzzz_: roshanavand: i had to turn off transactional fixtures to get it work properly though... implicit top-level transactions confuse things greatly
[23:23:27] roshanavand: jenrzzz_: this url is invalid
[23:24:29] cschneid_: has joined #ruby
[23:27:09] ramfjord: has joined #ruby
[23:28:16] havenwood: roshanavand: Not if you're on Apple's VPN. ;-P
[23:31:01] jready: has joined #ruby
[23:32:24] yxhuvud: has joined #ruby
[23:35:07] kies^: has joined #ruby
[23:36:06] jenrzzz_: roshanavand: lol sorry, too many githubs
[23:36:07] jenrzzz_: roshanavand: https://gist.github.com/jenrzzz/67f24eef4dfdfe42e32469d27e8b58d8
[23:36:37] ramfjord: has joined #ruby
[23:36:58] jenrzzz_: I really wish enterprise gist would say "enterprise" in the navbar somewhere
[23:39:09] gix: has joined #ruby
[23:39:37] dr3wo: has joined #ruby
[23:40:29] duderonomy: has joined #ruby
[23:45:56] karapetyan: has joined #ruby
[23:46:18] workmad3: has joined #ruby
[23:47:27] pwnd_nsfw`: has joined #ruby
[23:52:07] ramfjord: has joined #ruby
[23:53:20] karapetyan: has joined #ruby
[23:57:38] mikhael_k33hl: has joined #ruby
[23:57:58] mikhael_k33hl: What's the best gem for generating reports and sending it as an email?
[23:59:53] ramfjord: has joined #ruby