« Back to channel list

#ruby - 09 August 2019

« Back 1 day Forward 1 day »
[00:08:41] skryking_: has joined #ruby
[00:09:51] k0mpa: has joined #ruby
[00:10:07] phenom: has joined #ruby
[00:11:54] h3ll0w0rld: has joined #ruby
[00:11:57] k0mpa: has joined #ruby
[00:15:31] brool: has joined #ruby
[00:31:36] AJA4351: has joined #ruby
[00:31:40] Swyper: has joined #ruby
[00:44:26] s2013: has joined #ruby
[00:54:22] Swyper: has joined #ruby
[00:55:16] Retr0Punk: leftylink: are you around?
[00:58:33] jenrzzz_: has joined #ruby
[01:05:26] Swyper: has joined #ruby
[01:06:32] Fusl: has joined #ruby
[01:21:16] poontangmessiah: has joined #ruby
[01:23:13] AJA4351: has joined #ruby
[01:27:40] Swyper: has joined #ruby
[01:35:54] bambanx: has joined #ruby
[01:36:01] morenoh149: has joined #ruby
[01:45:11] _whitelogger: has joined #ruby
[01:48:12] cyclonis: has joined #ruby
[01:54:10] cyclonis: has joined #ruby
[02:00:11] cyclonis: has joined #ruby
[02:02:50] s2013: has joined #ruby
[02:06:12] cyclonis: has joined #ruby
[02:12:11] cyclonis: has joined #ruby
[02:14:15] s2013: has joined #ruby
[02:18:12] cyclonis: has joined #ruby
[02:24:13] cyclonis: has joined #ruby
[02:25:01] ffl^: has joined #ruby
[02:30:15] cyclonis: has joined #ruby
[02:30:48] AJA4351: has joined #ruby
[02:31:28] drincruz: has joined #ruby
[02:32:00] ramfjord: has joined #ruby
[02:36:15] cyclonis: has joined #ruby
[02:42:15] cyclonis: has joined #ruby
[02:48:16] cyclonis_: has joined #ruby
[02:58:00] dviola: has joined #ruby
[03:06:15] cyclonis: has joined #ruby
[03:06:59] s2013: has joined #ruby
[03:12:16] cyclonis: has joined #ruby
[03:18:15] cyclonis: has joined #ruby
[03:18:43] englishm: has joined #ruby
[03:19:41] englishm: has joined #ruby
[03:19:48] poontangmessiah_: has joined #ruby
[03:24:15] cyclonis: has joined #ruby
[03:27:02] s3nd1v0g1us: has joined #ruby
[03:30:16] cyclonis: has joined #ruby
[03:33:20] jenrzzz: has joined #ruby
[03:36:18] cyclonis: has joined #ruby
[03:42:19] cyclonis: has joined #ruby
[03:45:16] orbyt_: has joined #ruby
[03:48:15] kyrylo: has joined #ruby
[03:48:18] cyclonis: has joined #ruby
[03:54:19] cyclonis: has joined #ruby
[03:57:15] kyrylo: has joined #ruby
[04:00:21] cyclonis: has joined #ruby
[04:03:30] hutch: has joined #ruby
[04:05:44] kyrylo: has joined #ruby
[04:06:21] cyclonis: has joined #ruby
[04:11:04] morenoh149: has joined #ruby
[04:12:21] cyclonis: has joined #ruby
[04:14:02] kyrylo: has joined #ruby
[04:16:29] orbyt_: has joined #ruby
[04:18:21] cyclonis: has joined #ruby
[04:23:13] kyrylo: has joined #ruby
[04:24:23] cyclonis: has joined #ruby
[04:30:23] cyclonis: has joined #ruby
[04:32:48] krt^^: has joined #ruby
[04:36:23] cyclonis: has joined #ruby
[04:42:23] cyclonis: has joined #ruby
[04:43:36] Nicmavr: has joined #ruby
[04:48:23] cyclonis: has joined #ruby
[04:52:05] Tempesta: has joined #ruby
[04:52:05] Tempesta: has joined #ruby
[04:54:04] poontangmessiah: has joined #ruby
[04:54:22] cyclonis_: has joined #ruby
[05:19:31] ur5us: has joined #ruby
[05:28:04] Fr4n: has joined #ruby
[05:33:23] lalitmee: has joined #ruby
[06:00:08] dtzuzu: has joined #ruby
[06:08:07] dellavg: has joined #ruby
[06:09:57] duderonomy: has joined #ruby
[06:22:26] sagax: has joined #ruby
[06:39:32] aupadhye: has joined #ruby
[06:41:30] kyrylo: has joined #ruby
[06:44:22] lxsameer: has joined #ruby
[06:45:21] ramfjord: has joined #ruby
[06:46:09] ua: has joined #ruby
[06:54:48] TomyWork: has joined #ruby
[07:08:02] s3nd1v0g1us: has joined #ruby
[07:11:27] prestorium: has joined #ruby
[07:29:38] mat_bug: has joined #ruby
[07:31:47] duderonomy: has joined #ruby
[07:32:06] planigan: has joined #ruby
[07:33:28] suukim: has joined #ruby
[07:49:02] drnerdius: has joined #ruby
[07:54:30] deepredsky: has joined #ruby
[07:59:47] ellcs: has joined #ruby
[08:00:02] sauvin: has joined #ruby
[08:04:25] eddof13: has joined #ruby
[08:05:45] dsrt^: has joined #ruby
[08:07:13] mikecmpbll: has joined #ruby
[08:09:21] involans: has joined #ruby
[08:18:30] conta: has joined #ruby
[08:28:25] lalitmee: has joined #ruby
[08:29:44] involans: has joined #ruby
[08:32:05] lord4163: has joined #ruby
[08:32:45] involans: has joined #ruby
[08:38:11] fphilipe_: has joined #ruby
[08:56:58] salerace: has joined #ruby
[08:58:35] ellcs: has joined #ruby
[09:16:19] mat_bug: has joined #ruby
[09:18:40] mat_bug: has joined #ruby
[09:29:51] involans: has joined #ruby
[09:34:18] poontangmessiah_: has joined #ruby
[09:34:19] involans: has joined #ruby
[09:35:35] poontangmessiah_: has joined #ruby
[09:36:35] noob_coder: has joined #ruby
[09:36:43] noob_coder: has left #ruby: ()
[09:37:13] noob_coder: has joined #ruby
[09:37:35] noob_coder: has left #ruby: ()
[09:39:54] poontangmessiah: has joined #ruby
[09:40:35] drnerdius: has joined #ruby
[09:49:11] CrazyEddy: has joined #ruby
[09:52:40] jefffrails35: has joined #ruby
[09:55:23] tdy1: has joined #ruby
[09:55:46] Sylario: has joined #ruby
[09:59:57] deathwishdave: has joined #ruby
[10:02:31] keden: has joined #ruby
[10:03:32] mat_bug: has joined #ruby
[10:05:16] keden: has joined #ruby
[10:11:25] keden: has joined #ruby
[10:31:15] yottanami: has joined #ruby
[10:32:01] yottanami: I want to create a new game that the name contains dash character and it creates a directory in another. is anyway to disable this feature?
[10:32:56] drincruz: has joined #ruby
[10:34:46] drnerdius: has joined #ruby
[10:36:30] drnerdius: has joined #ruby
[10:38:20] jottr: has joined #ruby
[10:40:35] tobiasvl: yottanami: what feature are you talking about here? what kind of game?
[10:42:39] drnerdius: has joined #ruby
[10:43:43] poontangmessiah: has joined #ruby
[10:45:15] yottanami: tobiasvl, I just need initialize a simple CLI ruby application but the problem is the name of the project contains dash `-` and using `bundle gem` it converts each dash to a subdirectory
[10:45:51] yottanami: tobiasvl, for example `bundle gem test-project` will crate lib/test/project
[10:48:34] AJA4350: has joined #ruby
[10:51:39] teardown: has joined #ruby
[11:01:42] drnerdius: has joined #ruby
[11:05:46] beanie__: has joined #ruby
[11:12:48] yottanami: has joined #ruby
[11:15:26] nowhereman: has joined #ruby
[11:18:58] barg: i did brew upgrade a while back, and now when I type rails<ENTER> it gives an error about railties
[11:19:13] barg: if i do gem uninstall rails, it doesn't seem to do anything
[11:19:52] mat_bug: has joined #ruby
[11:20:07] barg: i guess i could try asking that in #rubyonrails
[11:30:20] hays: has joined #ruby
[11:39:30] involans: has joined #ruby
[11:40:08] mat_bug: has joined #ruby
[11:53:29] sh7d: has joined #ruby
[11:53:35] AJA4351: has joined #ruby
[11:58:43] involans: has joined #ruby
[11:59:33] involans: has joined #ruby
[12:00:20] mochiyoda: has joined #ruby
[12:07:16] drincruz: has joined #ruby
[12:13:54] lucasb: has joined #ruby
[12:17:45] mochiyoda: has joined #ruby
[12:17:55] mat_bug: has joined #ruby
[12:25:23] flok: has joined #ruby
[12:26:12] flok: Gemfile says: gem "mysql2", "~> 0.5.0", ruby-mysql2 package installed is 0.5.2-1ubuntu1, yet still I get Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? mysql2 is not part of the bundle. Add it to your Gemfile
[12:26:15] flok: any ideas?
[12:36:17] jcalla: has joined #ruby
[13:01:02] AJA4351: has joined #ruby
[13:01:26] flok: has left #ruby: ()
[13:02:44] Bish: has joined #ruby
[13:02:56] Bish: does ruby have pattern matching for hashes?
[13:03:11] Bish: ? = {a:2,b:2,c:2}
[13:03:19] Bish: so i can assign them to variables, kinda like with arrays?
[13:03:21] bmurt: has joined #ruby
[13:06:07] phaul: &>> a, b, c = * {a: 1, b: 2, c: 3}; [a, b, c]
[13:06:09] rubydoc: # => [[:a, 1], [:b, 2], [:c, 3]] (https://carc.in/#/r/7dni)
[13:06:57] phaul: though you could also just .to_a
[13:08:59] nerdius: has joined #ruby
[13:09:49] Bish: uhm, and that will work just by order or by name?
[13:10:29] Bish: that's not really pattern matching, right
[13:10:41] Bish: rather.. .to_a
[13:11:41] phaul: ruby doesnt really have pattern matching imho. As it doesnt have algebraic data types either
[13:12:33] Bish: yeah but it does a,b,c = [a,b,c]
[13:12:58] involans: has joined #ruby
[13:14:41] Bish: javascript has it too, while not having adts either
[13:15:34] deepredsky: has joined #ruby
[13:15:52] phaul: yeah I guess it depends on the definition of pattern matching. Probably you are right and that#s also considered pattern matching, it's just very different from pattern matching where that's not just a neat syntactic shortcut but a fundamental feature of the language
[13:16:48] Bish: well okay, i want syntactic sugar that looks like pattern matching
[13:17:32] Fernando-Basso: has joined #ruby
[13:17:50] phaul: for hashes you can assign them as arrays like that, or you can pass a hash to a method with matching keyword arguments.
[13:18:08] phaul: afaik that's all the tricks you can do with a hash in ruby
[13:18:17] involans: has joined #ruby
[13:19:19] Bish: well, i could also do a loop and extract them, i am aware about that...
[13:22:43] phaul: that just gave me an idea of looping and defining local vars from the keys.. which would do it by name as opposed to order
[13:24:04] Bish: yeah but that is like the most conventional way to do it there is
[13:24:22] Frobozz_: has joined #ruby
[13:28:48] phaul: though it doesn't even seem to work in my pry (or irb)
[13:28:57] phaul: &>> bin = binding; {a: 1, b: 2}.each { |k, v| bin.local_variable_set(k, v) } ; a
[13:28:59] rubydoc: stderr: -e:2:in `<main>': undefined local variable or method `a' for main:Object (NameError) (https://carc.in/#/r/7dnm)
[13:29:07] ellcs: has joined #ruby
[13:29:11] involans: has joined #ruby
[13:30:28] Inline: has joined #ruby
[13:31:44] phaul: Im guessing bin.local_variable_set does not constitute as the variable being declared in the local lexical scope, which would mean that you can't metaprogram this. I don't know...
[13:33:12] Bish: i did something like this, but from the perspective that i want to make my code prettier not uglier, that odesn't help
[13:33:58] phaul: sure :) I only said this because the fact it doesn't even work confused me
[13:34:25] Bish: it's not obvious to me either, but binding stuff is weird
[13:35:11] Bish: guess you can always eval *duck*
[13:35:26] mat_bug: has joined #ruby
[13:37:19] mat_bug: has joined #ruby
[13:40:06] involans: has joined #ruby
[13:42:13] phaul: &>> binding.local_variable_set :a, 1; a
[13:42:15] rubydoc: stderr: -e:2:in `<main>': undefined local variable or method `a' for main:Object (NameError) (https://carc.in/#/r/7dnn)
[13:42:33] phaul: &>> a = 2; binding.local_variable_set :a, 1; a
[13:42:34] rubydoc: # => 1 (https://carc.in/#/r/7dno)
[13:42:47] phaul: yeah, that proves the theory...
[13:54:17] drincruz: has joined #ruby
[13:55:12] involans: has joined #ruby
[13:55:37] lalitmee: has joined #ruby
[14:02:08] nerdius: has joined #ruby
[14:02:53] drincruz_: has joined #ruby
[14:03:13] codefriar: has joined #ruby
[14:07:24] Bish: wtf, range.count does fukin really count?
[14:11:22] Swyper: has joined #ruby
[14:17:37] chunkypuffs: has joined #ruby
[14:20:35] nerdius: has joined #ruby
[14:20:39] involans: has joined #ruby
[14:21:14] Frem: has joined #ruby
[14:21:52] kyrylo: has joined #ruby
[14:31:44] havenwood: (1..).size #=> Infinity
[14:32:00] havenwood: (1..).count # hangs
[14:40:28] bmurt: has joined #ruby
[14:41:09] AJA4351: has joined #ruby
[14:41:31] involans: has joined #ruby
[14:44:07] k0mpa: has joined #ruby
[14:54:31] duderonomy: has joined #ruby
[15:05:58] barg: I just did gem install rails, and it said 'bundler's executable "bundle" conflicts with /usr/local/lib/ruby/gems/2.6.0/bin/bundle'
[15:06:21] barg: overwrite the executable [yn]
[15:15:34] jottr_: has joined #ruby
[15:17:02] havenwood: barg: In Ruby 2.6, bundler is now a default gem. I saw an old issue where this was happening with other default gem binstubs, but it was fixed in RubyGems.
[15:17:26] havenwood: barg: Does it still happen with the latest RubyGems update?
[15:17:52] havenwood: barg: gem update --system
[15:18:29] havenwood: Ah, I'm thinking of a really old issue. Probably irrelevant.
[15:19:34] havenwood: barg: https://github.com/rubygems/rubygems/issues/2331
[15:23:46] Nicmavr: has joined #ruby
[15:28:13] barg: havenwood: i'm confused https://pastebin.com/raw/e6hrZAbH
[15:28:13] ruby[bot]: barg: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[15:28:29] barg: ok i'll use gisthub
[15:29:00] barg: https://gist.github.com/gartha1/da5a6b32b14a1818c02450f49c0b0674
[15:31:39] barg: havenwood: what do you suggest as a next step?
[15:31:57] barg: i think i should somehow remove any old ruby version and leave just the latest one
[15:32:11] barg: i'm not sure what directory ruby is meant to be in.. as i have two different ones
[15:42:54] wildtrees: has joined #ruby
[15:43:22] code_zombie: has joined #ruby
[15:43:30] eddof13: has joined #ruby
[15:44:29] wildtrees: has joined #ruby
[15:48:32] AJA4351: has joined #ruby
[15:48:56] wildtrees: has joined #ruby
[15:58:20] barg: any idea why i have two versions of ruby in two different locations?
[15:59:21] morenoh149: has joined #ruby
[16:00:39] barg: any idea why i have two versions of ruby in two different locations /usr/local/opt/ruby/bin/ruby has 2.6 and /usr/bin/ruby has 2.3
[16:00:50] barg: sorry didn't mean to repeat, but have included the locations now
[16:05:36] gix: has joined #ruby
[16:05:49] skryking: has joined #ruby
[16:15:47] RiPuk: has joined #ruby
[16:16:40] impermanence: has joined #ruby
[16:28:26] kyrylo: has joined #ruby
[16:33:21] kyrylo: has joined #ruby
[16:33:37] mozzarella: barg: which OS?
[16:37:52] cd: has joined #ruby
[16:40:14] kyrylo: has joined #ruby
[16:47:40] krt^^: has joined #ruby
[16:49:13] tdy1: has joined #ruby
[16:50:00] erk^: has joined #ruby
[16:51:10] _whitelogger: has joined #ruby
[16:52:08] eok^: has joined #ruby
[16:52:20] srt^: has joined #ruby
[16:52:42] ffl^: has joined #ruby
[16:52:55] tsrt^: has joined #ruby
[16:54:29] dsrt^: has joined #ruby
[16:56:06] aecepoglu[m]: has joined #ruby
[16:56:47] sgh^^: has joined #ruby
[16:56:58] hcs^: has joined #ruby
[17:00:16] mikecmpbll: has joined #ruby
[17:00:38] kyrylo: has joined #ruby
[17:14:26] stormpack: has joined #ruby
[17:15:08] str: has joined #ruby
[17:15:47] str: has left #ruby: ()
[17:18:17] havenwood: barg: Hi! I'd be happy to help you sort it out. First, what version of Ruby would you like to use? 2.6?
[17:18:56] ramfjord: has joined #ruby
[17:21:06] havenwood: barg: If you'd like to try a new, very simple way to install Rails 5 with Ruby 2.6 on macOS, you can try Tokaido. All you do is download it, right click, open it, click "open terminal" and you're good to go.
[17:21:22] havenwood: barg: Or we can help you get your brew/asdf/chruby/rvm/rbenv setup working.
[17:21:50] havenwood: barg: This is the Tokaido download, if you just want to start with Rails right now: https://github.com/tokaido/tokaidoapp/releases/download/v2.6-r523/Tokaido2.6.3p62r523.zip
[17:22:12] havenwood: barg: Or let us know which installer and switcher you'd like to use, or if you'd like help picking one, and we can get that setup.
[17:26:46] barg: havenwood: thanks. at the moment i want to get it sorted with no installer / switcher
[17:27:11] barg: i want 2.6 or the latest ruby
[17:27:20] barg: (latest stable ruby)
[17:27:39] barg: i dont want ruby in two locations, i want that neatened up
[17:27:50] havenwood: barg: If you don't want a switcher, I'd say just give Tokaido a try. Its for exactly this.
[17:27:58] havenwood: barg: Have you cleaned up the brew and asdf installs?
[17:28:02] havenwood: barg: which -a ruby
[17:28:27] havenwood: barg: You can just delete Tokaido when you decide you want to move to a switcher, if it comes to that.
[17:28:59] havenwood: barg: A brew Ruby or self-install are fine alternatives.
[17:29:04] barg: there is no asdf install, asdf was just some rails project
[17:29:05] havenwood: But they take more setup.
[17:29:27] barg: i want to remove all rubys then before i do tokaido
[17:29:31] barg: so it is fresh
[17:29:45] barg: and then i could install ruby via tokaido rather than brew
[17:29:51] havenwood: barg: What is the output of?
[17:29:52] havenwood: which -a ruby
[17:30:34] havenwood: barg: If you want to uninstall brew Ruby: brew uninstall ruby
[17:30:36] havenwood: barg: That's it.
[17:30:51] barg: sorry i'm having an issue over remote desktop
[17:30:59] barg: i'll just move upstairs.. 1min
[17:31:28] barg: -/usr/local/opt/ruby/bin/ruby
[17:31:28] barg: -/usr/bin/ruby
[17:31:46] barg: (just had to add the hiphen/dash so that it pasted!)
[17:31:56] barg: that's the output of which -a ruby
[17:32:08] havenwood: barg: looks good - brew ruby and system ruby
[17:32:45] havenwood: barg: there's also no hard in having those co-exist, or uninstall the brew one if you want
[17:33:10] barg: i just accidentally did brew ruby as a command, so that's running now
[17:33:27] barg: ok cancelled that
[17:33:41] barg: how would i remove system ruby?
[17:34:13] barg: and is it easily installable if i remove it?
[17:34:20] havenwood: barg: you're not supposed to do that
[17:34:26] havenwood: barg: your system uses that Ruby
[17:34:30] havenwood: barg: (system Ruby)
[17:34:44] havenwood: barg: Brew uses that Ruby too
[17:34:48] barg: is it standard to have the brew ruby first in the path?
[17:35:09] barg: and how did you even know that the first path was brew ruby?
[17:35:20] wallace_mu: has joined #ruby
[17:35:22] havenwood: barg: which -a is ordered
[17:35:26] havenwood: barg: you can: which ruby
[17:35:49] havenwood: barg: If you want to remove brew Ruby from path without uninstalling: brew unlink ruby
[17:36:15] barg: what exactly does that do?
[17:36:31] turt2live: has joined #ruby
[17:36:31] linuus[m]: has joined #ruby
[17:36:31] Seance[m]: has joined #ruby
[17:36:31] iotatron[m]: has joined #ruby
[17:36:31] qbrd[m]: has joined #ruby
[17:36:31] sepp2k: has joined #ruby
[17:36:34] havenwood: barg: it removes the symlinks for Ruby so they're no longer in the brew path
[17:36:34] barg: does it just amend the path?
[17:36:44] havenwood: barg: no, it removes links that are in the path
[17:37:09] barg: so how would i reverse brew unlink ruby?
[17:37:15] havenwood: barg: brew link ruby
[17:37:38] barg: and how can i view the brew path?
[17:37:50] havenwood: barg: you can link or unlink brew Ruby as much as you'd like - neither are any problem for other Rubies either
[17:38:03] havenwood: barg: ls /usr/local/bin
[17:39:22] havenwood: barg: Brew created your /usr/local/bin directory. You can see it's in your PATH: printenv PATH
[17:39:55] havenwood: barg: If you remove it from your PATH, brew executables won't be in your PATH anymore.
[17:40:31] barg: after doing brew unlink ruby, that worked, then brew link ruby i got an error https://gist.github.com/gartha1/3652a0f1b14de8b52b57d722afad272e
[17:40:56] havenwood: barg: Ah, looks like they've changed how that works.
[17:41:24] havenwood: barg: (It used to link in /usr/local/bin.)
[17:41:49] havenwood: barg: In any case, it's fine to delete or ignore the brew Ruby.
[17:41:51] havenwood: barg: It is a dependency of some other brew packages.
[17:41:52] kyrylo: has joined #ruby
[17:42:03] havenwood: barg: The system Ruby is a dependency of Brew itself.
[17:42:23] barg: ok so how would I upgrade the system ruby?
[17:42:28] havenwood: barg: You don't.
[17:42:34] havenwood: barg: Don't upgrade it. Don't use it. Ignore it.
[17:42:50] havenwood: barg: It's meant to be there, it's used by your system and brew.
[17:42:54] barg: ok, should the brew ruby be before the system ruby in the path?
[17:43:10] havenwood: barg: No, it shouldn't be unless you're trying to use it.
[17:43:31] barg: i am trying to use it as i want to use a later version of ruby
[17:43:41] barg: why else would somebody install ruby with brew?
[17:43:50] havenwood: barg: If you're trying to use it as your current Ruby, it should be in the path and its gem directory should be in your path - ahead of other Ruby's.
[17:43:54] havenwood: barg: it is a dependency of other brew packages
[17:44:01] havenwood: barg: people install something else, and it gets installed
[17:44:21] barg: i guess rubyists would tend to have the brew one before the system one?
[17:44:24] havenwood: barg: you can see *all* brew packages, even deps that were installed with: brew list
[17:44:35] havenwood: barg: on the other hand, to see packages you installed directly: brew leaves
[17:44:54] havenwood: you'll usually see far fewer `brew leaves` than `brew list`.
[17:44:59] barg: so how do i get ruby linked again, should i do brew reinstall ruby?
[17:46:00] havenwood: barg: Here's an example of setting up Brew Ruby with chruby: https://gist.github.com/havenwood/ba31f67c1d89ac236400
[17:46:37] havenwood: barg: They apparently stopped linking brew in /usr/local/bin, so you'll need to add it to your path. That gist ^ will use chruby to setup PATH, GEM_HOME, GEM_PATH, etc.
[17:46:54] havenwood: barg: If you'd like to do it manually, instead of using chruby, I can show you but it's more steps.
[17:47:20] havenwood: barg: chruby is just a few lines of code, but it helps you switch Rubies easily.
[17:47:54] havenwood: barg: It can also automatically switch Ruby versions based on the .ruby-version in a project's folder.
[17:48:02] barg: i'm interested in doing it manually
[17:48:16] havenwood: barg: If you wanted to, you could do it with chruby, then copy those env vars into a dotfile and uninstall chruby.
[17:48:39] barg: would brew reinstall ruby relink it?
[17:49:25] duderonomy: has joined #ruby
[17:50:24] havenwood: barg: they stopped linking ruby in /usr/local/bin
[17:50:31] havenwood: barg: they used to, they don't anymore
[17:50:49] havenwood: barg: you can see where brew Ruby is installed: brew --prefix ruby
[17:50:53] jottr__: has joined #ruby
[17:50:57] havenwood: barg: that bin/ dir is the Ruby binaries
[17:51:02] havenwood: so, add that to your path
[17:51:05] havenwood: then add the gem directory to your path
[17:51:07] havenwood: and you're done
[17:51:12] barg: so doing brew unlinke ruby doesn't matter?
[17:51:15] havenwood: prepend them to your path
[17:51:21] havenwood: barg: no, it's unlinked from the start
[17:51:51] havenwood: barg: it used to be linked by default. they changed it. it doesn't matter. you just add it to your path now.
[17:51:57] havenwood: barg: As the install and link message shows: export PATH="/usr/local/opt/ruby/bin:$PATH"
[17:52:00] barg: ok, i had started a brew reinstall ruby , hopefully that will finish soon
[17:53:47] barg: yeah it's prepended.. now it's rails that gives an error, i'll try gem uninstall rails and gem install rails
[17:54:06] havenwood: barg: rails is a gem, so that's a different bin dir to add to path
[17:54:16] havenwood: barg: check if the ruby executables work?
[17:54:19] havenwood: barg: ruby -v
[17:54:21] havenwood: barg: which ruy
[17:54:25] havenwood: barg: gem -v
[17:54:28] havenwood: barg: which gem
[17:54:34] barg: actually rails new sdfsdf says No such file or directory -- /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/exe/bundle (LoadError)
[17:54:52] barg: so should i do gem install bundler?
[17:55:16] havenwood: You should sanity check that your ruby and gem executables are as expected, then check: gem env gemdir
[17:55:30] havenwood: barg: which ruby
[17:55:32] havenwood: barg: which gem
[17:55:51] havenwood: barg: (Those ship with Ruby, and are a precursor to getting gems working.)
[17:56:01] havenwood: barg: If those are both brew, then: gem env gemdir
[17:56:10] havenwood: barg: What do you see from those commands?
[17:56:15] barg: -/usr/local/opt/ruby/bin/ruby and /usr/local/opt/ruby/bin/gem
[17:56:18] barg: so that's correct
[17:56:20] havenwood: good and good
[17:56:23] havenwood: gem env gemdir
[17:56:26] barg: i have my path set right in ¬/.bash_profile
[17:56:34] havenwood: what is?: gem env gemdir
[17:56:56] barg: -/usr/local/lib/ruby/gems/2.6.0
[17:57:04] barg: is that good ?
[17:57:30] havenwood: barg: export PATH="/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"
[17:57:50] havenwood: barg: Next: gem install rails
[17:57:51] barg: is the word export important?
[17:57:56] jottr__: has joined #ruby
[17:57:59] havenwood: barg: then: gem which rails
[17:58:25] havenwood: it's not an environment variable if unexported
[17:58:32] havenwood: and should be lowercase by convention
[17:58:50] havenwood: and can't be seen by child processes
[17:59:01] mikecmpb_: has joined #ruby
[17:59:38] barg: so in the path, should /usr/local/lib/ruby/gems/2.6.0/bin be first and /usr/local/opt/ruby/bin second?
[17:59:59] havenwood: Brew instructions should not just suggest adding "$(brew --prefix)/bin" to path but also show "$(gem env gemdir)/bin" since I see people run into this all the time.
[18:00:10] havenwood: barg: It doesn't matter.
[18:00:19] havenwood: barg: I'd do the other order, personally.
[18:00:51] havenwood: barg: No, actually that order.
[18:01:11] havenwood: barg: Important thing is Ruby AND Gem bin/ dirs prepended to you PATH.
[18:01:12] barg: and that gems/2.6.0/bin line is for the sake of bundle running from there?
[18:01:28] havenwood: barg: For the sake of all installed Gem executables.
[18:01:47] barg: i notice which bundle shows /usr/local/opt/ruby/bin/bundle
[18:01:51] havenwood: barg: Look in that directory, then install a gem with an executable and look again.
[18:01:53] barg: so that could be a potential clash
[18:02:10] havenwood: barg: Bundler is a default gem.
[18:02:12] havenwood: barg: https://stdgems.org/
[18:02:30] barg: when i do bundle install.. where do i want bundle to run from?
[18:02:46] havenwood: I have a meeting. Good luck!
[18:02:46] orbyt_: has joined #ruby
[18:02:50] barg: ok, thanks
[18:05:29] mynameisdebian: has joined #ruby
[18:06:51] bmurt: has joined #ruby
[18:14:57] adam12: barg: Run bundle install from the same folder that your Gemfile exists.
[18:16:50] orbyt_: has joined #ruby
[18:18:20] nerdius: has joined #ruby
[18:19:02] kyrylo: has joined #ruby
[18:23:23] kyrylo: has joined #ruby
[18:27:26] sameerynho: has joined #ruby
[18:35:40] FastJack: has joined #ruby
[18:41:23] nowhereman: has joined #ruby
[18:43:29] k0mpa: has joined #ruby
[18:49:42] FastJack: has joined #ruby
[18:50:08] salerace: has joined #ruby
[19:01:35] eddof13: has joined #ruby
[19:09:39] AndroidKitKat: has joined #ruby
[19:10:09] doshirae: has joined #ruby
[19:11:49] kyrylo: has joined #ruby
[19:11:52] nowhere_man: has joined #ruby
[19:16:24] AndroidKitKat: has joined #ruby
[19:19:28] mat_bug: has joined #ruby
[19:29:00] matju: has joined #ruby
[19:36:22] orbyt_: has joined #ruby
[19:43:33] ElFerna: has joined #ruby
[19:45:00] sagax: how to .map but not return if value not valid?
[19:45:16] sagax: [0, 1, nil] after .map [0, 1]
[19:45:19] sagax: this example
[19:46:34] phaul: what are you mapping? always itself?
[19:46:40] leftylink: but I thought that `a.map { ... }` always MUST have same number of elements as `a`. so wouldn't it have to be done after the map? for example, perhaps it can `compact`.
[19:47:08] sagax: phaul: just array
[19:47:30] baweaver: `compact` probably then,
[19:48:10] leftylink: when `filter_map` comes out, then maybe that will be better.
[19:48:17] tpanarch1st: has joined #ruby
[19:48:20] leftylink: but for now.
[19:48:26] baweaver: Was trying to remember if that was 2.7
[19:48:49] sagax: thank, i have old ruby and `compact` done
[19:48:49] baweaver: There's a lot in that one
[19:49:05] baweaver: To be fair, 2.7 isn't out yet
[19:54:51] jenrzzz: has joined #ruby
[19:58:49] jottr__: has joined #ruby
[20:07:13] cyclonis: has joined #ruby
[20:13:11] cyclonis: has joined #ruby
[20:18:34] D9: has joined #ruby
[20:19:11] cyclonis: has joined #ruby
[20:21:57] orbyt_: has joined #ruby
[20:24:38] za1b1tsu: has joined #ruby
[20:25:11] Dbugger: has joined #ruby
[20:25:12] cyclonis_: has joined #ruby
[20:28:36] k0mpa: has joined #ruby
[20:29:47] bitwinery: has joined #ruby
[20:31:13] cyclonis: has joined #ruby
[20:33:44] sagax: `&&` better then `and` ?
[20:33:46] davor: has joined #ruby
[20:33:50] sagax: in `if` context
[20:35:04] ur5us: has joined #ruby
[20:35:32] orbyt_: has joined #ruby
[20:35:49] nerdius: has joined #ruby
[20:37:32] cyclonis_: has joined #ruby
[20:37:36] matju: sagax, not much of a difference. The priority is different, which may add or remove need for parentheses. https://www.techotopia.com/index.php/Ruby_Operator_Precedence
[20:41:37] leftylink: https://github.com/rubocop-hq/ruby-style-guide#no-and-or-or gives the example of why you would want to use &&
[20:41:44] leftylink: &>> ok = true and false; ok
[20:41:45] rubydoc: # => true (https://carc.in/#/r/7dpg)
[20:42:34] leftylink: &>> ok = false or true; ok
[20:42:36] rubydoc: # => false (https://carc.in/#/r/7dph)
[20:43:08] fphilipe_: has joined #ruby
[20:47:16] ur5us: has joined #ruby
[20:49:31] fphilipe_: has joined #ruby
[20:49:31] cyclonis: has joined #ruby
[20:51:02] bhaak: has joined #ruby
[20:51:28] bambanx: has joined #ruby
[20:55:31] cyclonis: has joined #ruby
[20:58:49] cthulchu: has joined #ruby
[20:59:47] kyrylo: has joined #ruby
[21:01:31] cyclonis: has joined #ruby
[21:02:16] Nahra: has joined #ruby
[21:05:41] orbyt_: has joined #ruby
[21:06:42] chunkypuffs: has joined #ruby
[21:07:31] cyclonis: has joined #ruby
[21:10:14] henninb: has joined #ruby
[21:13:33] cyclonis: has joined #ruby
[21:15:51] mynameisdebian: I have a Ruby CGI script (A) that receives a JSON message from Slack that is retrieved as a Hash via cgi.params. That script then makes an HTTP request to a script (B) that needs to be able to receive either the exact Hash or the Hash parameters. When I try converting it to JSON in script A, then POST the JSON to script B, the message ends up with a bunch of extra commas and script B cannot decipher it. How can I correctly pass the CGI parameters
[21:15:51] mynameisdebian: from script A to script B?
[21:15:58] tdy1: has joined #ruby
[21:16:58] mynameisdebian: Should have said, "the message ends up with a bunch of extra backslashes"
[21:21:03] eddof13: has joined #ruby
[21:22:24] jenrzzz: has joined #ruby
[21:25:14] ElFerna: has joined #ruby
[21:36:24] bmurt: has joined #ruby
[21:38:46] jordanm: mynameisdebian: sounds like you are json encoding something that is already a json string and not a hash
[21:39:38] jordanm: since you are making CGI services anyways, you might as well just json.decode the request twice in script B :P
[21:39:40] ramfjord: has joined #ruby
[21:40:38] mynameisdebian: json.decode or json.parse?
[21:43:52] jordanm: parse, sorry, but I was joking
[21:44:34] barg: should bundle run from /usr/local/lib/ruby/gems/2.6.0 which is what i get from gem env gemdir, or I keep it to running from /usr/local/opt/ruby/bin/bundle which is what I get from which bundle ?
[21:52:04] za1b1tsu: has joined #ruby
[21:54:03] ElFerna: has joined #ruby
[21:54:24] eok^: has joined #ruby
[21:54:28] sgh^^: has joined #ruby
[21:54:29] krt^^: has joined #ruby
[21:54:29] srt^: has joined #ruby
[21:54:32] hcs^: has joined #ruby
[21:54:33] ffl^: has joined #ruby
[21:55:12] tsrt^: has joined #ruby
[21:55:14] erk^: has joined #ruby
[21:55:19] dsrt^: has joined #ruby
[21:59:53] erk^: has joined #ruby
[22:00:17] jottr__: has joined #ruby
[22:02:48] jenrzzz: has joined #ruby
[22:06:24] jakeb3: has joined #ruby
[22:06:57] jakeb3: Anyone know how to iterate over the members if a Fiddle::struct?
[22:07:03] jakeb3: of I mean
[22:10:34] kyrylo: has joined #ruby
[22:13:53] ffl^: has joined #ruby
[22:15:13] mikecmpbll: has joined #ruby
[22:16:02] kyrylo: has joined #ruby
[22:16:45] tipyn: has joined #ruby
[22:16:51] mynameisdebian: Is there a way to make a "detached" HTTP request with Ruby, so that the script makes the call and does not wait for it to return?
[22:17:48] havenwood: mynameisdebian: Are you familiar with Kernel#exec?
[22:17:58] mynameisdebian: havenwood, no :(
[22:18:28] mynameisdebian: havenwood, can you fill me in briefly?
[22:19:13] ChrisBr: has joined #ruby
[22:20:12] havenwood: mynameisdebian: or I guess in your case, fork. that's what we were suggesting the other day if you want it to work with CGI.
[22:20:37] havenwood: mynameisdebian: If you want a short, focused technical book - I recommend: https://www.jstorimer.com/products/working-with-unix-processes
[22:21:07] havenwood: mynameisdebian: Or the docs are shorter, and explain much less: https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-fork
[22:22:13] havenwood: mynameisdebian: You can "fork" another process off your Ruby process, then detach it so when you quit your Ruby process it keeps running and isn't zombied.
[22:22:24] havenwood: mynameisdebian: Jesse Storimer's book explains concepts around Processes clearly and in detail.
[22:23:10] havenwood: mynameisdebian: General reading about processes should suffice. We're just suggesting to fork so your CGI process can exit and let Apache return.
[22:23:48] havenwood: mynameisdebian: Or use Rack so you're not spinning up a Ruby process that needs to die before your request can return.
[22:24:13] havenwood: mynameisdebian: It's not hard to fork though. Give it a shot. If you have trouble using it, show your code.
[22:24:38] havenwood: mynameisdebian: I've not read this article, but it appears to show the very basics: https://www.tweetegy.com/2012/04/forking-ruby-processes-or-how-to-fork-ruby/
[22:25:29] mjacob: has joined #ruby
[22:25:47] havenwood: ACTION mutters something about zombie orphans when the last unicorn is killed
[22:26:33] jakeb3: Any suggestions for help with fiddle or ffi? Seems like ffi have a google group
[22:26:57] ur5us: has joined #ruby
[22:27:30] mikecmpbll: has joined #ruby
[22:28:49] Mortir_: has joined #ruby
[22:30:37] Mortir_: Is this place also for noob questions?
[22:32:08] phaul: Mortir_: sure, you can ask anything if it's Ruby related
[22:32:12] mynameisdebian: havenwood, thank you. I will try to work on that, but I'm under a deadline that I may very quickly be fired over, and I may not get the chance. So, please forgive me if I don't make it back to discuss my results
[22:32:26] havenwood: Mortir_: Please ask away!
[22:32:38] mynameisdebian: havenwood, there's no good way over IRC to properly convey one's appreciate for another's time
[22:34:15] havenwood: mynameisdebian: For example, try this code from your command line:
[22:34:16] havenwood: ruby -e "Process.detach fork { sleep 10; puts 'work goes here ...' }"
[22:34:32] havenwood: mynameisdebian: What did that do?
[22:35:38] mynameisdebian: havenwood, it did what I think you were expecting, but it will take me some time to wrap my head around the correct way to use that for my situation
[22:35:42] havenwood: mynameisdebian: Then try in your CGI script: Process.detach fork { sleep 10; puts 'work goes here ...' }
[22:36:12] havenwood: mynameisdebian: Remember, CGI spins up a Ruby process and will return when that process exits.
[22:36:32] havenwood: mynameisdebian: Does that make sense? If not, read up on processes.
[22:36:48] havenwood: mynameisdebian: I highly recommend that Jesse Storimer book.
[22:37:04] havenwood: If you want a solid grounding regarding processes and only have a couple hours to dig in.
[22:37:41] mynameisdebian: the last command didn't quite do what was intended because the script is responding to a Slack message, not a browser
[22:37:47] mynameisdebian: but I will try to read up on that
[22:37:51] involans: has joined #ruby
[22:38:08] mynameisdebian: got about 20 minutes to compile my work from last month to prove I'm worth a paycheck, wish me luck
[22:38:13] havenwood: mynameisdebian: Fork for the part that responds to Slack.
[22:38:21] havenwood: mynameisdebian: Just share the code and we'll show you where to fork.
[22:38:29] mynameisdebian: havenwood, I'll be in touch
[22:38:33] havenwood: mynameisdebian: Good luck!
[22:38:56] Mortir_: I have 4 classes which are arranged like this: https://i.postimg.cc/JzhtKZgZ/Class-Diagram.png
[22:39:02] havenwood: mynameisdebian: Put the part you want to happen in the background inside the {}s: Process.detach fork { }
[22:40:14] mat_bug: has joined #ruby
[22:40:33] Mortir_: After moving them into a "classes/" dir, the main file where they were being tested can't find them anymore.
[22:41:00] havenwood: Mortir_: Can you share the code?
[22:42:04] Mortir_: Test file: https://bpaste.net/raw/atzy
[22:42:59] Mortir_: Base: https://bpaste.net/raw/xmJz
[22:43:53] Mortir_: Institution: https://bpaste.net/raw/U4dS
[22:44:22] havenwood: Mortir_: What's the error you're seeing?
[22:44:40] havenwood: Mortir_: Normally you drop .rb when using #require and #require_relative.
[22:45:08] havenwood: Mortir_: The convention for naming files is to use a lower case derivative of the class or module name.
[22:45:30] havenwood: Mortir_: https://guides.rubygems.org/patterns/#consistent-naming
[22:46:33] havenwood: Mortir_: Do you have the `tree` command installed? If so, show us the directory tree?: tree
[22:46:52] havenwood: Mortir_: I'd suggest going ahead and renaming your files to lowercase and dropping the .rbs from your requires.
[22:47:16] havenwood: Mortir_: Then see if it's a require or require_relative that's failing, and which one. Show us the error if you're still stuck.
[22:48:00] Mortir_: SClass: https://bpaste.net/raw/QZWe
[22:48:05] Mortir_: Error: https://bpaste.net/raw/MuxD
[22:48:13] havenwood: Mortir_: https://guides.rubygems.org/name-your-gem/
[22:48:19] Mortir_: I'll change the names.
[22:48:35] havenwood: Mortir_: Don't use: require './Foo'
[22:48:46] havenwood: Mortir_: Instead: require_relative 'Foo'
[22:48:53] havenwood: Mortir_: But, lowercase those.
[22:49:11] havenwood: Mortir_: If it's in the parent directory: require_relative '../foo'
[22:50:35] Mortir_: No "tree" command, but there is only a testing.rb file, and a "classes" dir with the files I mentioned.
[22:51:17] contradictioned: has joined #ruby
[22:53:07] Skaterhaym: has joined #ruby
[22:56:00] contradictioned: has joined #ruby
[22:56:03] Mortir_: havenwood: Your suggestion worked, appreciated the help. =D
[22:58:45] ElFerna: has joined #ruby
[22:59:43] poontangmessiah: has joined #ruby
[23:10:31] kyrylo: has joined #ruby
[23:22:00] ElFerna: has joined #ruby
[23:23:02] ElFerna01: has joined #ruby
[23:24:38] ElFerna: has joined #ruby
[23:25:47] ElFerna: has joined #ruby
[23:29:59] morenoh149: has joined #ruby
[23:30:23] ElFerna: has joined #ruby
[23:31:15] tpanarch1st: has joined #ruby
[23:37:44] bitwinery: has joined #ruby
[23:47:13] jottr__: has joined #ruby
[23:50:07] kyrylo: has joined #ruby