« Back to channel list

#ruby - 24 October 2018

« Back 1 day Forward 1 day »
[00:01:06] nowhere_man: has joined #ruby
[00:01:07] mroutis: has joined #ruby
[00:04:13] al2o3-cr: phaul: what repl you tesinging in?
[00:04:32] kurko__: has joined #ruby
[00:05:34] al2o3-cr: i got two mins
[00:08:07] phaul: no repl. just create 2 files, x.rb; y.rb. y.rb require 'x'; local vars defined in x are not available in y
[00:08:23] phaul: executing ruby y.rb
[00:12:53] Xiti: has joined #ruby
[00:13:11] phaul: hm, in fact y is not executing top level either.
[00:14:54] phaul: if I explcitly use TOPLEVEL + get / set I can communicate local vars across files. but if I just assume that y is running in the TOPLEVEL context accessing local vars set in the other file fails
[00:15:34] TvL2386: has joined #ruby
[00:20:07] nicesignal: has joined #ruby
[00:20:17] nowhere_man: has joined #ruby
[00:21:24] phaul: we shall crack this mystery tomorrow :) cya all
[00:21:49] wolfshappen: has joined #ruby
[00:22:19] mroutis: bye, phaul
[00:28:20] bmurt: has joined #ruby
[00:29:21] nchambers: has joined #ruby
[00:30:37] xfbs: has joined #ruby
[00:31:38] MoritaShinobu: has joined #ruby
[00:40:42] ansraliant: has joined #ruby
[00:49:47] xuanrui: has joined #ruby
[01:04:03] jp: has joined #ruby
[01:06:28] marmotini_: has joined #ruby
[01:16:01] marmotini_: has joined #ruby
[01:21:50] ph88: has joined #ruby
[01:22:04] ph88: how can i upgrade ruby to latest stable with rvm ?
[01:22:21] ph88: i tried a bunch of commands but they don't seem to have effect
[01:23:57] havenwood: ph88: I'd suggest going ahead and using master, since a release is imminent: rvm get head
[01:24:22] havenwood: ph88: The command to update to the stable release is: rvm get stable
[01:25:22] ph88: havenwood, i did that now https://bpaste.net/show/5420cd9c9293
[01:26:27] ph88: when i open new shell and do ruby -v i get ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
[01:26:31] xfbs: has joined #ruby
[01:28:16] shakes: has joined #ruby
[01:29:05] ph88: rvm change a lot of things in my config files ..
[01:33:31] havenwood: ph88: rvm install ruby
[01:33:43] havenwood: ph88: The latest stable Ruby is 2.5.3.
[01:33:51] nowhere_man: has joined #ruby
[01:35:07] havenwood: ph88: Then: rvm --default use 2.5.3
[01:35:13] ph88: https://bpaste.net/show/54145981a462
[01:35:39] ph88: Using /home/ph88/.rvm/gems/ruby-2.5.3
[01:35:52] ph88: when i open new shell i get ruby 2.4
[01:36:13] havenwood: ph88: Did you set?: rvm --default use 2.5.3
[01:36:48] ph88: yes, output was: Using /home/ph88/.rvm/gems/ruby-2.5.3
[01:37:04] havenwood: and when you open a new shell, what is?: which -a ruby
[01:37:38] ph88: it's 2 lines: /home/ph88/.rvm/rubies/ruby-2.4.0/bin/ruby /usr/bin/ruby
[01:37:58] havenwood: ph88: is 2.5.3 listed under?: rvm list
[01:38:26] havenwood: ph88: what is?: rvm -v
[01:38:37] ph88: https://bpaste.net/show/6b98d8aecc8f
[01:39:10] ph88: https://bpaste.net/show/ec79cabbd2d3
[01:39:18] mroutis: has joined #ruby
[01:39:19] havenwood: ph88: so current Ruby is 2.4 but default is 2.5.3. hmm
[01:39:52] havenwood: do you have a .ruby-version, Gemfile or the like in your current directory?
[01:40:26] havenwood: ph88: If you explicitly run `rvm use 2.5.3` what is?: which ruby
[01:40:46] ph88: it's /home/ph88/.rvm/rubies/ruby-2.5.3/bin/ruby
[01:41:01] ph88: but when i open another shell it's 2.4
[01:41:03] havenwood: ph88: So it seems mksh isn't using the default for some reason. I don't know why.
[01:41:52] ph88: shall i remove all rvm code that rvm put in my dotfiles ?
[01:42:03] havenwood: ph88: I don't think RVM properly supports mksh: https://github.com/rvm/rvm/issues/3142
[01:42:31] ph88: i don't know what mksh is
[01:42:35] ph88: i use zsh
[01:42:52] havenwood: ph88: Hrm, I swear I saw mksh in your pastes. maybe I've just been up too long.
[01:43:24] havenwood: ph88: Ah, maybe it just detected you had a dotfile. Yeah, that's all.
[01:43:50] ph88: https://bpaste.net/show/5420cd9c9293 line 23 perhaps
[01:44:03] ph88: i don't know why the .mkshrc dotfile is there
[01:44:08] ph88: i never used mksh AFAIK
[01:44:35] havenwood: ph88: It's nothing, just me not paying close enough attention to realize it's irrelevant.
[01:45:12] havenwood: ph88: And I assume `rvm current` from a fresh shell also says 2.4?
[01:46:31] ph88: this is what my PATH looks like after i replace colon with newline https://bpaste.net/show/bef82fe45296
[01:47:52] havenwood: ph88: Is `which ruby` the RVM 2.4?
[01:48:38] ph88: it's /home/ph88/.rvm/rubies/ruby-2.4.0/bin/ruby
[01:49:54] havenwood: ph88: and `rvm default && ruby -v` is 2.5.3 from a fresh shell?
[01:50:17] havenwood: I assume it is. I don't know why the default is getting overridden with 2.4.
[01:50:50] ph88: rvm default && ruby -v from fresh shell 2.5.3
[01:51:18] ph88: maybe i can just remove all and start over ?
[01:51:38] havenwood: ph88: Yeah, that's a good bet. Turn it off and back on again!
[01:51:45] havenwood: ph88: rvm implode --force
[01:52:21] havenwood: ph88: your .rvm/bin dir is also far back in PATH
[01:52:32] havenwood: you might want to move the RVM stuff to the front of PATH
[01:53:36] havenwood: RVM likes to be first in PATH, to ensure it can switch.
[01:53:46] ph88: how do i start over now ?
[01:54:01] havenwood: ph88: \curl -sSL https://get.rvm.io | bash
[01:54:17] havenwood: ph88: rvm install ruby
[01:54:31] havenwood: ph88: rvm --default use 2.5.3
[01:54:56] ph88: https://rvm.io/rvm/install#ubuntu ?
[01:55:24] havenwood: ph88: You're on Ubuntu?
[01:55:44] ph88: i don't think i used my package manager before to install rvm the last time
[01:55:56] havenwood: I don't know about that.
[01:56:06] havenwood: Someone else here might.
[01:56:14] ph88: ill just go with \curl -sSL https://get.rvm.io | bash
[01:56:55] ph88: don't i need to do rvm get head before rvm install ruby ?
[01:57:20] havenwood: ph88: that ^ command should have already fetched master
[01:58:10] havenwood: ph88: then sanity check: rvm list
[01:59:08] ph88: all good now
[01:59:10] ph88: thx for the help
[01:59:17] havenwood: nice, you're welcome
[02:01:02] openstruct: has joined #ruby
[02:10:57] Dimik: has joined #ruby
[02:11:21] openstruct: I'm in a situation where I need to use two versions of the elasticsearch gem to write to two instances of elasticsearch that are different versions. Is my best bet to fork the gem and rename it to something else so that I can use them both?
[02:14:50] esrse: has joined #ruby
[02:17:15] bhaak: has joined #ruby
[02:23:52] jp: has joined #ruby
[02:24:19] akosednar: has joined #ruby
[02:28:56] agent_white: has joined #ruby
[02:41:21] m0nty0ne: has joined #ruby
[02:43:51] nofxx: has joined #ruby
[02:46:39] tdy: has joined #ruby
[02:48:27] Puffball: has joined #ruby
[02:57:10] lupine: openstruct: I'd expect that to get very messy, very quicklyt
[02:57:27] lupine: can you split into two separate processes, one for each version, each with their own Gemfile ?
[02:58:15] openstruct: lupine: Was mostly a temporary idea while I do the upgrade, but I'm an hour into renaming elasticsearch and it is quite messy.
[02:58:57] openstruct: I suppose I could have two processes running...
[03:09:38] braincrash: has joined #ruby
[03:11:34] evdubs: has joined #ruby
[03:16:55] zacts: has joined #ruby
[03:20:02] mangold: has joined #ruby
[03:40:38] dnewkerk: has joined #ruby
[03:53:23] dellavg_: has joined #ruby
[03:59:05] xfbs: has joined #ruby
[04:11:00] xfbs: has joined #ruby
[04:11:05] kapil____: has joined #ruby
[04:19:24] danguita: has joined #ruby
[04:19:26] mroutis: has joined #ruby
[04:21:12] mangold: has joined #ruby
[04:29:38] marmotini_: has joined #ruby
[04:41:34] nowhereman: has joined #ruby
[04:42:48] dogweather: has joined #ruby
[04:42:51] tdy: has joined #ruby
[04:46:07] za1b1tsu: has joined #ruby
[04:47:15] arescorpio: has joined #ruby
[05:01:49] Vashy: has left #ruby: ("Leaving")
[05:17:24] SteenJobs: has joined #ruby
[05:41:47] bga57: has joined #ruby
[05:47:08] reber: has joined #ruby
[05:56:09] aupadhye: has joined #ruby
[06:11:32] venmx: has joined #ruby
[06:18:45] mangold: has joined #ruby
[06:22:16] voolik: has joined #ruby
[06:28:16] SuperL4g: has joined #ruby
[06:30:55] Emmanuel_Chanel: has joined #ruby
[06:31:49] SuperLag: has joined #ruby
[06:34:44] Sirecote: has joined #ruby
[06:36:38] cpallares: has joined #ruby
[06:45:48] dionysus69: has joined #ruby
[07:00:16] dionysus69_: has joined #ruby
[07:01:16] cloaked1: has joined #ruby
[07:11:45] voolik: has joined #ruby
[07:11:58] clemens3: has joined #ruby
[07:30:52] drbrain: has joined #ruby
[07:31:39] tuor: has joined #ruby
[07:33:37] phaul: has joined #ruby
[07:38:59] DoubleMalt: has joined #ruby
[07:56:36] mangold: has joined #ruby
[07:59:36] za1b1tsu: has joined #ruby
[08:12:22] mikecmpbll: has joined #ruby
[08:16:31] rubydoc: has joined #ruby
[08:39:31] dogweather: has joined #ruby
[08:43:08] dogweather: has joined #ruby
[08:51:04] negev: has joined #ruby
[08:53:32] zapata: has joined #ruby
[08:58:39] venmx: has joined #ruby
[08:59:13] negev: hi, does this: https://gist.github.com/m4rkw/1dcdbb3dfe63b29b5343b70a28ce1c5b indicate a memory leak or am i misunderstanding how that should work?
[09:11:24] Bish: has joined #ruby
[09:11:26] Bish: >> [true,false].repeated_permutation(5).first
[09:11:32] ruby[bot]: Bish: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[09:12:02] Bish: is that thing broken?
[09:43:42] danguita: has joined #ruby
[09:44:13] nexraf1_: has joined #ruby
[09:47:19] nexraf1_: has joined #ruby
[09:50:58] nexraf1_: has joined #ruby
[09:53:53] nexraf1_: has joined #ruby
[09:58:37] nexraf1_: has joined #ruby
[10:03:54] lytol_: has joined #ruby
[10:21:59] leitz: has joined #ruby
[10:25:41] ineb: has joined #ruby
[10:33:43] apparition: has joined #ruby
[10:43:11] ruby[bot]: Bish: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[10:43:20] xfbs: has joined #ruby
[10:43:21] phaul: Bish: it's eval.in
[10:43:22] Bish: that was too musk to ask sorry ruby[bot]
[10:43:43] phaul: it's been giving 500 internal server errors for weeks now
[10:43:53] Bish: didn't notice
[10:58:00] vondruch_: has joined #ruby
[10:59:34] kurko_: has joined #ruby
[11:01:26] mikecmpbll: has joined #ruby
[11:23:19] vondruch: has joined #ruby
[11:24:34] ruby[bot]: here's your pizza: 🍕
[11:25:08] phaul: thank you
[11:32:06] ruby[bot]: Here's a snowman for you: ☃
[11:34:44] ldnunes: has joined #ruby
[11:40:56] roshanavand: has joined #ruby
[11:45:55] rubydoc: has joined #ruby
[11:45:56] Guest75806: has joined #ruby
[11:46:35] Bish: i've seen that snowman in a stackoverflow post regarding csv in ruby
[11:47:00] Bish: that guy did quote_char:'☃' so it doesn't quote anything
[11:47:16] Bish: since you cannot provide nil there
[11:47:23] drale2k_: has joined #ruby
[11:55:02] AJA4350: has joined #ruby
[12:00:05] whysthatso: has joined #ruby
[12:01:33] roshanavand: has joined #ruby
[12:02:12] wojnar: has joined #ruby
[12:02:17] Bish: whysthatso: nice nick
[12:02:48] whysthatso: it's my long time companion :)
[12:07:31] Bish: would fit me well :>
[12:10:52] xfbs: has joined #ruby
[12:12:34] jottr: has joined #ruby
[12:21:24] whysthatso: has joined #ruby
[12:24:31] bmurt: has joined #ruby
[12:26:35] xfbs: has joined #ruby
[12:45:31] whysthatso: @Bish well, that's not an option any more now, is it
[12:50:58] za1b1tsu: has joined #ruby
[13:04:46] MuffinPimp: has joined #ruby
[13:11:09] bak1an: has joined #ruby
[13:13:33] dionysus69_: has joined #ruby
[13:35:47] chongtxtx: has joined #ruby
[13:42:35] cxl: has joined #ruby
[13:45:46] Rapture: has joined #ruby
[13:46:30] nexraf1: has joined #ruby
[13:49:03] nexraf1: has joined #ruby
[13:59:06] vondruch_: has joined #ruby
[14:03:33] Inline: has joined #ruby
[14:06:34] discopatrick: has joined #ruby
[14:10:12] rubydoc: has joined #ruby
[14:13:39] nchambers: has joined #ruby
[14:14:41] dionysus69: has joined #ruby
[14:17:26] nexraf1_: has joined #ruby
[14:20:30] gnufied: has joined #ruby
[14:27:54] vondruch: has joined #ruby
[14:28:35] Azure: has joined #ruby
[14:29:32] dionysus69: any idea why these two examples are returning incorrect results? https://gist.github.com/webzorg/b4e3d783ea1aa8a37970ecca8f1b43e5
[14:29:52] dionysus69: the icorrect one should return 0.778457 instead of 0.08
[14:32:37] samort7: has joined #ruby
[14:33:12] marmotini_: has joined #ruby
[14:35:13] SteenJobs: has joined #ruby
[14:40:16] rubydoc: has joined #ruby
[14:44:13] Cork: anyone know how to convert the integer 257 to [1,1] in ruby? (bytes in an array)
[14:46:20] phaul: 257.divmod 256 would result in [1,1]
[14:46:51] phaul: but Im not sure what the conversion rules are here
[14:47:56] Cork: well as one byte can't be more then 256 the rest ends up in the next byte
[14:48:06] Cork: but ya divmod might be a solution
[14:48:39] Cork: but ya, cool that is exactly what i needed! thx!
[14:49:06] phaul: you are welcome
[14:54:41] rippa: has joined #ruby
[15:00:14] chouhoulis: has joined #ruby
[15:01:26] orbyt_: has joined #ruby
[15:09:24] JusticeFries: has joined #ruby
[15:09:28] phaul: ?float, dionysus69
[15:09:44] ruby[bot]: Your numbers don't add up? You get "weird" results? read http://floating-point-gui.de/
[15:12:23] dionysus69: phaul: no it is big_decimal
[15:14:59] phaul: what makes it bigdecimal?
[15:15:27] dionysus69: I converted it above and then I also checked later on second line it is also Bdecimal
[15:17:04] dionysus69: incorrect i is being returned
[15:17:12] dionysus69: it should return 5 or 6 instead of 1
[15:17:16] dionysus69: in the incorrect example
[15:18:40] phaul: but isnt the issue that by that time you convert to bigdecimal you already lost some precision with floats?
[15:19:47] dionysus69: that's not the issue though in this particular example, it is regex :S
[15:23:51] beowuff: has joined #ruby
[15:24:36] eddof13: has joined #ruby
[15:38:43] akaiiro: has joined #ruby
[15:42:34] Cork: anybody know how to parse a OpenSSL::PKey::EC key from a byte string?
[15:42:52] Cork: OpenSSL::PKey::EC.new doesn't seam capable of parsing
[15:45:43] orbyt_: has joined #ruby
[15:47:33] Guest75806: has joined #ruby
[15:47:35] juri_: has left #ruby: ()
[15:49:27] blackmesa: has joined #ruby
[15:52:04] dbugger_: has joined #ruby
[15:52:12] beefjoe: has joined #ruby
[15:52:45] ineb: urgh how would i imeplement a long running task that returns something and reports its status? ret = task.run { |progress| p progress }
[15:53:05] ineb: in this case its a push based design and if 'p progress' blocks, everything blocks.
[15:53:56] ineb: does some sort of async yield makes sense here? or does make a pull based approach more sense?
[15:55:20] ineb: job_status = job.run; while job_status.finished?; p status.progress; job_status.value
[15:55:26] ineb: or something like that
[15:58:11] baweaver: ineb: y'mean until job finished?
[15:58:25] baweaver: Set a variable in the loop that you define above it.
[15:59:19] baweaver: Blocks set up a lexical closure. That's fancy talk for saying they remember the area around where they were defined, and if a variable is defined outside, it can set stuff to it.
[15:59:32] baweaver: Otherwise that new variable is only in the block, and it's not getting out.
[15:59:52] baweaver: Don't remember if while and until work like that though
[16:00:10] phaul: no whle and until are not scopes
[16:00:35] baweaver: Stuck in Rambda land again
[16:01:45] baweaver: n = 5; while n > 0; x = n; n -= 1; end; p x
[16:02:04] baweaver: ACTION should get some coffee
[16:02:08] ineb: here are my two solutions i can think of https://paste.xinu.at/y3NGJQ/rb
[16:03:19] ineb: whats the better variant for an api? like a fileupload or something
[16:03:26] baweaver: How does task_status work?
[16:03:43] baweaver: using S3 uploaders mostly
[16:03:51] baweaver: or ActiveStorage
[16:04:04] baweaver: Most of them defer to a job queue of some sort that's built in
[16:07:09] jcarl43: has joined #ruby
[16:08:09] phaul: ineb: so here you are providing the task API, and you are asking how to give control to your users if they want to print progres..?
[16:08:38] ineb: phaul: yes
[16:09:59] phaul: who creates the task? you or them?
[16:10:12] phaul: ie who defines what's in the task
[16:11:53] ineb: me. its really just one possible task here
[16:12:10] ineb: no configuration needed so far
[16:12:30] phaul: I like your first solution then. Its simple
[16:13:05] ineb: ok thanks
[16:15:10] conta1: has joined #ruby
[16:15:44] SteenJobs: has joined #ruby
[16:18:36] anothertorusr: has joined #ruby
[16:23:15] ramfjord: has joined #ruby
[16:25:04] Creatornator: has joined #ruby
[16:33:56] beefjoe: has joined #ruby
[16:37:56] rubydoc: has joined #ruby
[16:40:00] orbyt_: has joined #ruby
[16:43:29] chamunks: has joined #ruby
[16:45:15] dmitch: has joined #ruby
[16:45:29] eckhardt_: has joined #ruby
[16:46:03] kurko_: has joined #ruby
[16:46:52] darkhanb: has joined #ruby
[16:47:10] mikecmpb_: has joined #ruby
[17:02:43] blackmesa: has joined #ruby
[17:05:46] ramfjord: has joined #ruby
[17:07:43] akem: has joined #ruby
[17:09:49] mzo: has joined #ruby
[17:10:57] xuanrui: has joined #ruby
[17:12:27] ramfjord: has joined #ruby
[17:20:19] ramfjord: has joined #ruby
[17:21:35] akem: has joined #ruby
[17:22:02] desperek: has joined #ruby
[17:43:01] chouhoulis: has joined #ruby
[17:47:10] xfbs: has joined #ruby
[17:48:09] chouhoulis: has joined #ruby
[17:50:41] tdy: has joined #ruby
[17:51:16] Xiti: has joined #ruby
[17:52:52] Synthead: has joined #ruby
[17:53:32] Synthead: is there a lib that'll help convert something like "200M" (a string from user input) to bytes in 200 MiB?
[18:03:07] Synthead: Filesize.from seems to do the trick! Thanks!
[18:05:20] ramfjord: has joined #ruby
[18:11:29] SteenJobs: has joined #ruby
[18:12:01] akem: has joined #ruby
[18:13:04] ramfjord: has joined #ruby
[18:13:57] Eiam: has joined #ruby
[18:15:36] dmitch: has joined #ruby
[18:16:10] jottr: has joined #ruby
[18:16:37] Creatornator: has joined #ruby
[18:18:18] AJA4350: has joined #ruby
[18:20:23] AJA4350: has joined #ruby
[18:22:39] akem: has joined #ruby
[18:24:21] akemot: has joined #ruby
[18:30:28] kurko_: has joined #ruby
[18:31:54] SteenJobs: has joined #ruby
[18:39:10] OrangeManBad: has joined #ruby
[18:39:11] donofrio_: has joined #ruby
[18:39:11] cthu|: has joined #ruby
[18:39:36] marmotini: has joined #ruby
[18:39:53] MyMind: has joined #ruby
[18:41:02] Lytol: has joined #ruby
[18:41:26] flips_: has joined #ruby
[18:41:32] catsed: has joined #ruby
[18:41:35] LenPayne_: has joined #ruby
[18:41:36] r3m_: has joined #ruby
[18:41:48] ged_: has joined #ruby
[18:42:20] m4rCsi: has joined #ruby
[18:43:22] chihhsin: has joined #ruby
[18:43:42] ohcibi_: has joined #ruby
[18:43:47] dostoyev1ky: has joined #ruby
[18:43:48] crankhar1er: has joined #ruby
[18:44:18] miah_: has joined #ruby
[18:45:12] c0ncealed4: has joined #ruby
[18:48:43] Freeaqingme: has joined #ruby
[18:49:20] TheBrayn: has joined #ruby
[18:49:43] fribmendes: has joined #ruby
[18:50:04] jidar: has joined #ruby
[18:50:11] Creatornator: has joined #ruby
[18:50:15] m27frogy: has joined #ruby
[18:50:20] ramfjord: has joined #ruby
[18:50:42] leafyleong: has joined #ruby
[18:50:44] funnel: has joined #ruby
[18:54:42] troulouliou_div2: has joined #ruby
[18:54:58] Aloy: has joined #ruby
[18:55:31] Paraxial: has joined #ruby
[18:55:31] troulouliou_div2: has joined #ruby
[18:56:29] clemens3: has joined #ruby
[19:00:21] akem: has joined #ruby
[19:07:39] cd: has joined #ruby
[19:17:48] akem: has joined #ruby
[19:21:13] mikecmpbll: has joined #ruby
[19:21:44] bmurt: has joined #ruby
[19:25:44] cd: has joined #ruby
[19:32:36] ellcs: has joined #ruby
[19:32:36] akemot: has joined #ruby
[19:32:41] blackmesa: has joined #ruby
[19:33:42] Xiti: has joined #ruby
[19:33:58] Nicmavr: has joined #ruby
[19:48:25] orbyt_: has joined #ruby
[19:48:52] xfbs: has joined #ruby
[19:52:22] whysthatso: has joined #ruby
[19:59:42] Xiti: has joined #ruby
[20:23:22] negev: has left #ruby: ()
[20:23:54] jottr: has joined #ruby
[20:25:23] xuanrui: has joined #ruby
[20:25:23] SteenJobs: has joined #ruby
[20:27:16] samort7: having trouble sorting an array of hashes
[20:27:46] samort7: [{:item_list=>[["1", "Smokey Black", "https://eaassets-a.akamaihd.net/battlelog/battlebinary/gamedata/Tunguska/79/115/Horse-Cavalry-b18d43ed.png"]], :kit_num=>"19", :kit_name=>"Horse"}, {:item_list=>[["0", "Armored Mortar Truck", "https://eaassets-a.akamaihd.net/battlelog/battlebinary/gamedata/Tunguska/100/119/armored-mortar-truck-9c892702.png"], ["1", "Golden Shell", "https://eaassets-a.akamaihd.net/battlelog/battlebinary/gamedata/Tunguska/26/28/Tank-Armor
[20:27:46] samort7: ed-e6e4f709.png"]], :kit_num=>"15", :kit_name=>"Artillery Truck"}, {:item_list=>[["0", "Ground Support Attack Plane", "https://eaassets-a.akamaihd.net/battlelog/battlebinary/gamedata/Tunguska/113/23/ground-support-2-seater-71e9cea3.png"]], :kit_num=>"13", :kit_name=>"Attack Plane"}]
[20:28:16] samort7: How would I sort the array of hashes based on the value of the :kit_num key?
[20:33:12] phaul: array.sort_by { |h| h[:kint_num] }
[20:33:23] samort7: Here's a better formatted version
[20:33:23] samort7: https://codeshare.io/2pOl7E
[20:33:37] samort7: phaul: I tried that but I keep getting undefined method 'kin_num' error
[20:34:03] phaul: that's a typo. kit_num
[20:34:19] phaul: that's because you are missing the :
[20:34:28] phaul: read my version carefully
[20:36:59] samort7: it did work
[20:37:19] samort7: shouldn't sort_by!(&:kit_num) also work?
[20:37:51] phaul: that would assume you have a method on the items kit_num
[20:38:06] phaul: it would work with openstructs instead of hashes for instance
[20:40:01] phaul: its a shortened form of sort_by! { |x| x.kit_num }
[20:40:34] samort7: ok, i was confusing symbols with methods i guess
[20:41:00] phaul: to be fair :something is always a symbol.
[20:41:37] phaul: this &: is a bit of magic syntax to shorten blocks..
[20:41:58] phaul: but what's after the & is a symbol
[20:43:00] Creatornator: has joined #ruby
[20:43:25] phaul: a = :length ; ['a', 'bb'].sort_by(&a)
[20:43:30] phaul: also works
[20:44:01] mochiyoda: has joined #ruby
[20:44:13] eddof13: has joined #ruby
[20:45:52] phaul: well this isn't true : phaul | but what's after the & is a symbol
[20:46:24] orbyt_: has joined #ruby
[20:46:57] nexraf1_: has joined #ruby
[20:47:58] phaul: anything that responds to to_proc ... Symbol, Proc, Method
[20:49:59] s2013: has joined #ruby
[20:50:17] c0ncealed4: has joined #ruby
[20:51:48] samort7: ah, that can be a bit confusing i guess
[20:52:46] phaul: [1,2,3].map(&-> x { 2 * x })
[20:53:02] akemot: has joined #ruby
[20:54:33] kujira: has joined #ruby
[20:54:34] phaul: class X; def to_proc; -> x { x }; end; end; [1,2,3].map(&X.new)
[21:02:05] chouhoulis: has joined #ruby
[21:07:32] chouhoulis: has joined #ruby
[21:13:48] dmitch: has joined #ruby
[21:18:31] chouhoulis: has joined #ruby
[21:19:24] Creatornator: has joined #ruby
[21:22:36] cliluw: has joined #ruby
[21:22:47] trif: has joined #ruby
[21:31:55] ujjain: has joined #ruby
[21:39:14] blackmesa: has joined #ruby
[21:39:51] baweaver: phaul: want to know something real magic?
[21:40:10] baweaver: ....there's one more thing that responds to to_proc
[21:40:51] baweaver: Hash#to_proc ~ -> key { self[key] }
[21:40:56] phaul: &list to_proc
[21:40:56] rubydoc: Hash#to_proc, Method#to_proc, Proc#to_proc, Symbol#to_proc
[21:41:20] phaul: makes sense though
[21:41:43] cd: has joined #ruby
[21:41:50] baweaver: >> [:a, :b, :c].map(&{a: 1, b: 2, c: 3})
[21:42:54] phaul: cool, learning something new every day :)
[21:44:58] zenspider: doesn't mean it's a good idea...
[21:45:14] OrangeManBad: has joined #ruby
[21:52:38] jtdowney: has joined #ruby
[21:53:16] havenwood: has joined #ruby
[21:53:28] akemot: has joined #ruby
[21:55:28] agrecascino: has joined #ruby
[21:55:58] phaul: interesting... ruby[bot] did not even bother apologising this time.
[21:56:11] ruby[bot]: phaul: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[21:56:24] phaul: there we go :)
[22:02:32] Creatornator: has joined #ruby
[22:02:45] xfbs: has joined #ruby
[22:05:57] leitz: has joined #ruby
[22:06:20] tdy: has joined #ruby
[22:08:04] eddof13: has joined #ruby
[22:08:48] venmx: has joined #ruby
[22:10:37] baweaver: zenspider: ugh?
[22:12:48] Dimik: has joined #ruby
[22:20:48] dmitch: has joined #ruby
[22:21:14] phaul: i was just checking out hanami this afternoon, which led me to read most of dry-ruby docs. I'm not convinced. I mean,, I was doing haskell before. so most concepts are familiar to me. But some things just feel so over-engineered in Ruby in those examples.
[22:24:53] Creatornator: has joined #ruby
[22:29:00] phaul: the dry-matcher.. the dependency container thing.. It's all about whats fashionable, but I dont like the trend
[22:30:10] phaul: funny how rails is the opposite of what the cool kids are doing these days.
[22:31:33] bmurt: has joined #ruby
[22:32:31] phaul: good old fahsioned DSL in your classes :D
[22:36:34] phaul: I think we are heading somewhere with functional to where we had been with UML in the 2000s
[22:40:07] juria_roberts: has joined #ruby
[22:40:30] juria_roberts: How does ruby provide configure_args and envroot?
[22:46:11] Creatornator: has joined #ruby
[22:48:17] baweaver: juria_roberts: for?
[22:48:26] baweaver: ACTION doesn't know what either of those are
[22:48:42] zenspider: juria_roberts: not sure your words/question make sense...
[22:49:00] zenspider: phaul: I tend to agree
[22:49:29] baweaver: The problem with most FP gems in Ruby is that they try and be Haskell
[22:49:48] zenspider: I try as much as possible to stick to "do the simplest thing that can possibly work" and that pushes back heavy on all of the dry-* packages (last I looked)
[22:50:00] baweaver: It's a flawed premise from the start, as Ruby has a ton of power to do similar things in its own ways
[22:50:35] baweaver: That said, making an eloquent DSL / syntax for it is danged hard.
[22:50:45] phaul: yeah, nice to hear Im not alone
[22:50:55] akemot: has joined #ruby
[22:51:00] zenspider: phaul: calibrate accordingly... I'm an edge case. :P
[22:51:14] baweaver: and I'm a basket case
[22:51:22] Puffball: has joined #ruby
[22:51:25] phaul: Im in good company then
[22:51:36] phaul: fit right in
[22:54:51] baweaver: I've mentioned some of this to them in the past, they're aware, it's just a really hard problem to come up with a good API for it
[22:59:14] phaul: juria_roberts: I don't know these things either, but Im guessing this is a packaging question? like configure_args was what was used to build ruby binary?
[23:00:22] hays: anyone do chruby as a local/user install only?
[23:00:42] hays: i guess just build it with --prefix=$HOME or something?
[23:00:55] ellcs: has joined #ruby
[23:01:52] hays: one thing i like about rbenv is you can tuck it away in a user directory
[23:02:17] orbyt_: has joined #ruby
[23:05:48] cliluw: has joined #ruby
[23:15:42] havenwood: hays: I use a home dir for chruby.
[23:16:23] havenwood: hays: With ruby-install, the default is ~/.rubies if you don't use sudo.
[23:16:52] hays: you just put it in $HOME/.local?
[23:19:12] hays: for chruby itself
[23:19:52] havenwood: hays: ah, I see what you're saying - no, I haven't bothered with that but it does work to prefix, like you suggested
[23:20:33] im0nde: has joined #ruby
[23:20:51] havenwood: hays: https://gist.github.com/havenwood/6233659
[23:21:08] havenwood: hays: that's ^ an example i wroteup a while ago
[23:22:36] Creatornator: has joined #ruby
[23:23:23] hays: why --no-install-deps
[23:23:59] havenwood: hays: assuming no permissions to do so
[23:29:59] zenspider: juria_roberts: ...
[23:30:17] mangold: has joined #ruby
[23:31:56] zenspider: havenwood: wget -O ruby-install-0.6.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.0.tar.gz ?!?
[23:32:19] zenspider: a tarball? oh... because bootstrap issue if it were a gem?
[23:32:37] zenspider: still... why not a git checkout?
[23:33:53] zenspider: man... I'm trying to profile and optimize this code and while the profile is pointing me at things worth working on and my microbenchmarks are definitely showing improvements... the actual improvement on the top level benchmark is ... zero
[23:39:19] SeepingN: has joined #ruby
[23:43:04] zxq2: has joined #ruby
[23:55:59] Creatornator: has joined #ruby
[23:57:37] SteenJobs: has joined #ruby
[23:58:37] houhoulis: has joined #ruby