« Back to channel list

#ruby - 05 July 2018

« Back 1 day Forward 1 day »
[00:02:31] kvda: has joined #ruby
[00:07:20] graphene: has joined #ruby
[00:10:20] mupt: has joined #ruby
[00:13:57] caleBOT_: has joined #ruby
[00:16:19] yokel: has joined #ruby
[00:17:19] karapetyan: has joined #ruby
[00:18:01] jottr: has joined #ruby
[00:32:43] mikeiniowa: has joined #ruby
[00:35:19] baweaver: apeiros / Bish: xf
[00:35:36] baweaver: https://github.com/baweaver/xf
[00:35:45] ciscam: has joined #ruby
[00:36:01] baweaver: hashes.select(&Xf[:key_name])
[00:36:16] BloopMonster: has joined #ruby
[00:36:46] baweaver: Ah, wait, it was Mf for that one.
[00:37:25] baweaver: Mf (modifier functions, overrided operators) - Xf (Scope/Trace for deep hashes) - Qo (Pattern Matching) - Yet (you'll see, but already got the gem name :D)
[00:50:14] bradleyprice: has joined #ruby
[00:53:31] Jushy: has joined #ruby
[00:58:30] jottr: has joined #ruby
[00:59:51] Azure: has joined #ruby
[01:10:45] blackmesa: has joined #ruby
[01:11:49] cadillac_: has joined #ruby
[01:12:57] tolerablyjake: has joined #ruby
[01:25:16] roamingdog: has joined #ruby
[01:26:01] roamingdog: has joined #ruby
[01:26:51] roamingdog: has joined #ruby
[01:27:39] roamingdog: has joined #ruby
[01:29:25] r0nin: has joined #ruby
[01:38:29] bjpenn: has joined #ruby
[01:41:57] gell5: has joined #ruby
[01:52:12] roamingdog: has joined #ruby
[01:53:13] gell5: has joined #ruby
[02:00:32] roamingdog: has joined #ruby
[02:01:22] roamingdog: has joined #ruby
[02:02:07] roamingdog: has joined #ruby
[02:02:56] roamingdog: has joined #ruby
[02:03:46] roamingdog: has joined #ruby
[02:06:20] subroot: has joined #ruby
[02:07:21] nicht: has joined #ruby
[02:11:11] mupt: has joined #ruby
[02:12:53] jottr: has joined #ruby
[02:18:46] karapetyan: has joined #ruby
[02:18:56] houhoulis: has joined #ruby
[02:19:09] MagePsycho: has joined #ruby
[02:20:03] akaiiro: has joined #ruby
[02:20:27] mrBen2k2k2k: has joined #ruby
[02:23:00] tolerablyjake: has joined #ruby
[02:40:03] caleBOT: has joined #ruby
[02:42:21] taylorzr: has joined #ruby
[02:51:02] jinie: has joined #ruby
[02:57:47] kryptoz: has joined #ruby
[02:58:48] bsamorim: has joined #ruby
[03:00:18] cadillac_: has joined #ruby
[03:07:26] StarSeed0000: has joined #ruby
[03:10:14] braincrash: has joined #ruby
[03:12:32] s3nd1v0g1us: has joined #ruby
[03:17:25] kvda: has joined #ruby
[03:21:30] kvda: has joined #ruby
[03:33:09] xuyuheng: has joined #ruby
[03:40:39] xuyuheng: has joined #ruby
[03:41:34] gix-: has joined #ruby
[03:51:23] bjpenn: has joined #ruby
[03:56:25] ciscam: has joined #ruby
[03:58:47] pauliesaint: has joined #ruby
[04:02:58] rshetty: has joined #ruby
[04:08:13] bsamorim: has joined #ruby
[04:09:00] shinnya: has joined #ruby
[04:13:07] mupt: has joined #ruby
[04:14:08] jottr: has joined #ruby
[04:14:29] rshetty: has joined #ruby
[04:20:16] karapetyan: has joined #ruby
[04:23:44] bradleyprice: has joined #ruby
[04:23:51] rshetty: has joined #ruby
[04:43:41] shinnya: has joined #ruby
[04:45:11] leah2: has joined #ruby
[04:46:33] lupine: has joined #ruby
[04:47:51] duderonomy: has joined #ruby
[04:52:02] mynameisdebian: has joined #ruby
[05:15:59] NightMonkey: has joined #ruby
[05:19:33] roamingdog: has joined #ruby
[05:25:59] reber: has joined #ruby
[05:38:39] schleppel: has joined #ruby
[05:39:14] kvda: has joined #ruby
[05:43:53] apeiros: has joined #ruby
[05:50:49] anisha: has joined #ruby
[05:54:05] aupadhye: has joined #ruby
[05:58:14] mtkd: has joined #ruby
[06:02:03] cyberg: has joined #ruby
[06:07:42] zlogan2003: has joined #ruby
[06:10:29] mozzarella: has joined #ruby
[06:10:56] alex``: has joined #ruby
[06:14:22] mupt: has joined #ruby
[06:14:38] Nicmavr: has joined #ruby
[06:15:02] jottr: has joined #ruby
[06:21:55] karapetyan: has joined #ruby
[06:37:50] brahmana: has joined #ruby
[06:37:58] ellcs: has joined #ruby
[06:41:44] bairyn: has joined #ruby
[06:42:16] dionysus69: has joined #ruby
[06:42:57] graphene: has joined #ruby
[06:50:53] suukim: has joined #ruby
[06:51:46] StarSeed0000: has joined #ruby
[06:56:18] TomyWork: has joined #ruby
[06:57:26] TvL2386_: has joined #ruby
[06:57:58] yohji: has joined #ruby
[06:58:02] mozzarella: has joined #ruby
[07:01:51] brahmana: has joined #ruby
[07:02:54] Mike11: has joined #ruby
[07:02:58] brahmana: Hi all.. I am sending a HTTP POST request from my ruby program. The post body size is : 12026283. I am getting an EPIPE error. But the server has received all the data.
[07:03:28] brahmana: What could have caused the EPIPE error?
[07:04:12] sysvalve: has joined #ruby
[07:09:08] simmaniac: has joined #ruby
[07:11:22] claudiuinberlin: has joined #ruby
[07:18:47] rshetty: has joined #ruby
[07:20:38] rshetty: has joined #ruby
[07:20:48] BloopMonster: has joined #ruby
[07:21:21] MagePsycho: anyone using capistrano here?
[07:24:46] kryptoz: has joined #ruby
[07:25:41] kryptoz: has joined #ruby
[07:25:54] kvda: has joined #ruby
[07:26:53] lxsameer: has joined #ruby
[07:28:56] NightMonkey: has joined #ruby
[07:29:38] naftilos76: has joined #ruby
[07:30:32] burgestrand: has joined #ruby
[07:41:14] zapata: has joined #ruby
[07:43:14] ellcs: has joined #ruby
[07:43:34] kvda: has joined #ruby
[07:44:15] alem0lars: has joined #ruby
[07:48:29] tvw: has joined #ruby
[07:51:21] pauliesaint: has joined #ruby
[07:54:04] pauliesaint: has joined #ruby
[07:59:51] graphene: has joined #ruby
[08:00:47] mikecmpbll: has joined #ruby
[08:01:24] pauliesaint: has joined #ruby
[08:04:52] Beams: has joined #ruby
[08:08:25] blackmesa: has joined #ruby
[08:10:32] za1b1tsu: has joined #ruby
[08:11:01] bairyn: has joined #ruby
[08:15:13] mupt: has joined #ruby
[08:17:45] jraavis: has joined #ruby
[08:18:53] rshetty: has joined #ruby
[08:26:50] pauliesaint: has joined #ruby
[08:42:51] rshetty: has joined #ruby
[08:46:55] andikr: has joined #ruby
[08:50:04] mikecmpbll: has joined #ruby
[08:50:24] NL3limin4t0r: has joined #ruby
[08:52:19] amar_: has joined #ruby
[08:53:15] nowhere_man: has joined #ruby
[08:54:34] jottr: has joined #ruby
[08:55:10] konsolebox: has joined #ruby
[08:56:43] biberu: has joined #ruby
[08:59:00] ellcs: has joined #ruby
[09:00:25] Hexafox[I]: has joined #ruby
[09:00:33] rshetty: has joined #ruby
[09:01:10] dhollin3: has joined #ruby
[09:01:21] Gbardis: has joined #ruby
[09:02:05] conta: has joined #ruby
[09:02:21] alem0lars: has joined #ruby
[09:04:53] anikras: has joined #ruby
[09:05:37] anikras: hi, i have an application in ruby&rails and I have my app.po with language translated
[09:05:53] anikras: but, when I am changed language I have this error
[09:05:58] anikras: No such file or directory @ rb_sysopen - config/locale/ca/app.po
[09:06:24] Gbardis: has joined #ruby
[09:06:42] Hexafox[I]: has joined #ruby
[09:07:32] Hexafox[I]: My internet just cut out and I can't tell if my last messages sent so I'll resend them.
[09:07:39] Hexafox[I]: Does anyone here have advice for getting "go to definition" working in vim?
[09:07:48] Hexafox[I]: I have been trying to see if vim is a usable replacement for rubymine but this feature is absolutely critical and I can't see much up to date info
[09:08:35] anikras: I am using this version: ruby 2.3.1p112
[09:08:46] WinterFox[m]: has joined #ruby
[09:10:36] Gbardis: hey everyone , i want to read a larger txt file(8gb) . i use File.foreach to read the file, but i alway get this error 'ArgumentError: negative string size (or size too big)'
[09:11:20] Gbardis: There is a way to read this file ?
[09:11:44] konsolebox: Hexafox[I]: it would be a little bit surprising if vim has that feature
[09:12:27] Hexafox[I]: konsolebox, Not by default but I'm pretty sure it can with plugins.
[09:12:49] Hexafox[I]: I just can't see how vim is useful for ruby development without this.
[09:13:20] konsolebox: Hexafox[I]: yeah, i guess someone might have made a plugin for it
[09:14:08] konsolebox: anikras: try #RubyOnRails too
[09:14:14] JackMc: has joined #ruby
[09:15:16] konsolebox: Gbardis: are you using a 64-bit version of Ruby?
[09:15:56] konsolebox: Gbardis: ruby --version
[09:16:23] Gbardis: konsolebox: i have no idea if it is 64 bit , ruby version 2.5.1
[09:17:27] rippa: has joined #ruby
[09:17:35] Gbardis: konsolebox: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
[09:23:12] gregf_: has joined #ruby
[09:23:52] karapetyan: has joined #ruby
[09:26:24] sphenxes: has joined #ruby
[09:27:16] Sylario: has joined #ruby
[09:30:29] konsolebox: Gbardis: how about the output of `ruby -e 'puts 0.size'`?
[09:31:59] konsolebox: Gbardis: i tried it on a 5G file (size greater than 2^32), and it doesn't show the error
[09:32:52] amar_: has joined #ruby
[09:33:13] Gbardis: konsolebox: The output is 8
[09:34:01] konsolebox: well that's odd
[09:34:04] rshetty: has joined #ruby
[09:34:35] konsolebox: Gbardis: the way you execute File.foreach is like this, correct? File.foreach('/path/to/file'){ |line| puts line }
[09:34:59] Gbardis: konsolebox: correct
[09:36:01] konsolebox: Gbardis: care to show a snippet of the command?
[09:37:16] amar_: has joined #ruby
[09:37:25] rshetty: has joined #ruby
[09:38:36] pnkl: has joined #ruby
[09:39:42] Gbardis: has joined #ruby
[09:40:10] guille-moe: has joined #ruby
[09:43:07] Gbardis: konsolebox: https://gist.github.com/GBardis/4779d9c5999e6f2089eb1f8480fdea9e
[09:51:53] anikras: konsolebox, ok, thanks
[09:52:54] RougeR: has joined #ruby
[09:57:09] clemens3: has joined #ruby
[09:57:50] Gbardis: konsolebox: i manage to create a smaller files and test the file read , i cant read file larger than 2gb
[09:59:49] konsolebox: Gbardis: that might be build or system-related
[10:02:07] Gbardis: konsolebox: hmmm ok ,what ruby version use to test file read ?
[10:04:46] konsolebox: Gbardis: i don't think it really has something to do with versions of Ruby, (i tested it with 2.2 and 2.5). it's probably on how Ruby is configured during its compilation from source, or the features the system or the library provides
[10:06:15] konsolebox: Gbardis: perhaps you can ask your distro on how they built the ruby package, and report the error
[10:08:27] Gbardis: konsolebox: I understand,thnx for your time.
[10:12:59] jraavis: has joined #ruby
[10:15:59] mupt: has joined #ruby
[10:18:56] kryptoz: has joined #ruby
[10:19:34] simmaniac: has joined #ruby
[10:20:26] agimenez: has joined #ruby
[10:22:24] Technaton: has joined #ruby
[10:25:46] anisha: has joined #ruby
[10:36:46] drale2k_: has joined #ruby
[10:43:23] rshetty: has joined #ruby
[10:45:51] rshetty: has joined #ruby
[10:46:45] nowhere_man: has joined #ruby
[10:47:01] apeiros: has joined #ruby
[10:55:27] jottr: has joined #ruby
[10:58:51] mattb20: has joined #ruby
[10:58:54] mattb20: hi anyone here got a good handle on rspec? I am writing a bank app, I want to test my bank class will make a call to the transaction class when user makes a deposit, however it appears to not be calling it even if I have what I see, the correct code, can someone help? test snippet and method snippet here https://gist.github.com/mattb20/f98091f75dee6a07ed567fa4074bccc0
[10:58:57] jrafanie: has joined #ruby
[11:00:09] canton7: mattb20, first point: you need to set up the expectations *first8
[11:00:41] InfinityFye: has joined #ruby
[11:00:56] InfinityFye: has left #ruby: ()
[11:01:30] mattb20: Thanks, I would appreciate any advice re: coupling using doubles etc as well!
[11:02:00] Radar: That seems to be written in an older syntax of RSpec.
[11:02:11] Radar: (should_receive vs expect(Transaction).to receive(:new))
[11:03:07] mattb20: what exactly do you mean set up the expectations?
[11:03:27] mattb20: so I would write my expectation as the first line and then underneath call the function?
[11:03:38] mattb20: I also had this issue where I was specifying 3 arguments it was only receiving 1
[11:05:17] Radar: mattb20: https://gist.github.com/radar/9bd5610cf35fcea3d25303d1119a7623
[11:05:28] mattb20: oh that's strange, putting on the bottom line passes it
[11:05:30] mattb20: why is that?
[11:05:36] Radar: Arrange, Act, Assert.
[11:05:47] Radar: Except when checking when methods get called ;)
[11:06:01] Radar: top line in your spec should be expect(Transaction).to receive(:new)
[11:06:03] mattb20: is it because the function finishes the call so it doesn't know anything to do with what goes on during the execution? if you put the expecation before its expecting a call?
[11:06:13] Radar: mattb20: https://relishapp.com/rspec/rspec-mocks/docs/basics/expecting-messages
[11:06:34] mattb20: thanks, and do you think I should be using a double in test?
[11:06:55] Radar: Not in this test.
[11:06:59] amar_: has joined #ruby
[11:18:19] rshetty: has joined #ruby
[11:30:57] nowhere_man: has joined #ruby
[11:33:46] RougeR: has joined #ruby
[11:33:46] RougeR: has joined #ruby
[11:33:50] ldnunes: has joined #ruby
[11:34:54] jottr: has joined #ruby
[11:35:37] kobain: has joined #ruby
[11:36:25] kapil___: has joined #ruby
[11:37:28] ikbenhet: has joined #ruby
[11:38:24] reber__: has joined #ruby
[11:39:12] noobineer: has joined #ruby
[11:43:01] AJA4350: has joined #ruby
[11:43:32] Technaton: has joined #ruby
[11:44:34] anisha: has joined #ruby
[11:53:49] nowhereman_: has joined #ruby
[12:01:12] RougeR: has joined #ruby
[12:01:13] RougeR: has joined #ruby
[12:09:18] BloopMonster: has joined #ruby
[12:09:32] anisha: has joined #ruby
[12:15:01] zautomata: has joined #ruby
[12:16:22] jottr: has joined #ruby
[12:18:07] rshetty: has joined #ruby
[12:19:09] Bish: if i have [[1,[2,3,4]],[5,[6,7,9]]]
[12:19:24] Bish: is there a cool way to get
[12:19:45] Bish: [1,2],[1,3],[1,4],[5,6],[5,7]
[12:19:52] Bish: other than inject/each_with_object ?
[12:20:00] drale2k_: has joined #ruby
[12:20:42] jraavis: has joined #ruby
[12:22:01] burgestrand: >> [[1,[2,3,4]],[5,[6,7,9]]].map { |(a, b)| [a].product(b) }.flatten(1)
[12:22:02] ruby[bot]: Burgestrand: # => [[1, 2], [1, 3], [1, 4], [5, 6], [5, 7], [5, 9]] (https://eval.in/1032030)
[12:23:46] bak1an: has joined #ruby
[12:25:02] Dbugger: has joined #ruby
[12:25:59] eblip: has joined #ruby
[12:26:09] def_jam: has joined #ruby
[12:30:20] canton7: >> [[1,[2,3,4]],[5,[6,7,9]]].flat_map{|a,b|[a].product(b)}
[12:30:21] ruby[bot]: canton7: # => [[1, 2], [1, 3], [1, 4], [5, 6], [5, 7], [5, 9]] (https://eval.in/1032043)
[12:30:24] canton7: ACTION shaved a couple of characters off
[12:31:04] desperek: has joined #ruby
[12:42:30] anisha: has joined #ruby
[12:42:43] maasha: has joined #ruby
[12:42:51] ellcs1: has joined #ruby
[12:43:02] maasha: I forgot how to make ruby include gems in ~/.gem ?
[12:43:28] Bish: i figured something like that
[12:44:33] Bish: maasha: depends on your environment variables
[12:44:43] Bish: and or configuration
[12:44:52] maasha: Bish: none set
[12:45:02] maasha: On Debian/Linux
[12:45:59] jrafanie: has joined #ruby
[12:47:55] konsolebox: maasha: default setup should include them, unless Debian makes it act differently, or you're trying to include gems installed for a different version of ruby
[12:48:06] jottr: has joined #ruby
[12:48:31] maasha: konsolebox: this is deep inside some docker image - so everything is a bit funky
[12:48:43] pauliesaint_: has joined #ruby
[12:49:00] Bish: maasha: so it has nothing to do with your debian at all :D
[12:49:01] maasha: konsolebox: basically I have copied compiled gems from one image to another to reduce image size
[12:49:13] konsolebox: maybe a debian image
[12:49:15] Bish: maasha: are you root when installing them?
[12:49:16] maasha: Bish: well, it is a Unix type OS :o)
[12:49:25] Bish: maasha: so is mac os x
[12:49:37] Bish: so is the the new windows kernel
[12:49:48] maasha: Bish: Debian could be Herd
[12:49:58] Bish: maasha: fair enough
[12:50:20] Bish: well, docker tends to be root inside the docker file
[12:50:30] Bish: you might have ran bundler or whatever as root
[12:50:37] Bish: which would result your games to be installed
[12:50:39] Bish: /usr/local
[12:50:45] Bish: or /usr/lib
[12:51:37] rshetty: has joined #ruby
[12:52:00] maasha: So gems are in /home/biodsl/.gems/ - I think I need to set some GEM_HOME or GEM_PATH env
[12:52:28] konsolebox: or you need to run it as biodsl
[12:54:21] kryptoz: has joined #ruby
[12:56:36] Bish: sudo -u biodsl bundler install
[12:56:53] Bish: or with docker natively
[12:57:44] NL3limin4t0r: Burgestrand: use flat_map instead, it has a performance advantage over .map.flatten(1)
[12:58:02] NL3limin4t0r: >> [[1,[2,3,4]],[5,[6,7,9]]].flat_map { |(a, b)| [a].product(b) }
[12:58:03] ruby[bot]: NL3limin4t0r: # => [[1, 2], [1, 3], [1, 4], [5, 6], [5, 7], [5, 9]] (https://eval.in/1032103)
[13:00:32] konsolebox: maasha: maybe you can use them: https://unix.stackexchange.com/questions/203376/how-to-set-ruby-gem-home-and-gem-path. just watch out for binary incompatibilities.
[13:00:40] maasha: konsolebox: I am biodsl, but I get '`require': cannot load such file -- BioDSL (LoadError)'
[13:01:07] addyluxe: has joined #ruby
[13:01:20] Bish: NL3limin4t0r: somebody already said that
[13:01:26] konsolebox: maasha: run `ruby -e 'puts Gem.user_dir'` and see if the output matches your gems directory
[13:01:40] NL3limin4t0r: Bish: Look at my comment above.
[13:01:46] maasha: konsolebox: I did try GEM_HOME and GEM_PATH, but that didn't do the trick, perhaps that is specific to rvm
[13:05:30] konsolebox: maasha: no, perhaps your version of ruby is different like i said
[13:05:55] jcalla: has joined #ruby
[13:06:27] Bish: NL3limin4t0r: somebody already said that
[13:06:30] maasha: konsolebox: yes, hmm
[13:07:19] konsolebox: maasha: it's really hacky to reuse gems that were built from a different system because of possible incompatibility with the system or the installed ruby
[13:08:26] maasha: konsolebox: yup, I want to reduce docker image size from ~800Mb. The goal is 130Mb (base image is 101Mb)
[13:08:59] konsolebox: why not just work on top of alpine
[13:09:51] maasha: konsolebox: this biodsl requires extensions to be build using gcc. I am most confident with Debian type systems.
[13:10:22] maasha: konsolebox: so I need the build-essentials packages and they are bulky
[13:11:58] bsamorim: has joined #ruby
[13:12:04] cadillac_: has joined #ruby
[13:12:23] zapata: has joined #ruby
[13:18:22] Inline: has joined #ruby
[13:24:51] mupt: has joined #ruby
[13:25:22] konsolebox: maasha: you can try building the gems on a temporary image with build-essentials package. you then transfer the .gem directory to the real image. it may work if the built gems end up not requiring runtime dependencies from the build-essentials package. it's a risk that's up to you to take.
[13:26:46] maasha: konsolebox: that is exactly what I am working on. Got it to work even! Image is 287Mb, so still need to remove 50% if possible
[13:26:56] mattb20: has joined #ruby
[13:27:49] Hanmac: has joined #ruby
[13:27:49] Mike11: has joined #ruby
[13:27:58] mattb20: hello, sorry I have another question about rspec https://gist.github.com/mattb20/c50851f5b3abe7ef0ada62af7d800136, this code and spec is giving me TypeError: no implicit conversion of Array into Integer on line 5, wtf!?
[13:28:33] konsolebox: maasha: a Gentoo-based distro or image is very ideal for your target, but unfortunately you want Debian
[13:29:05] maasha: konsolebox: ah, well, I always go back to Debian for stability
[13:29:23] Dimik: has joined #ruby
[13:29:26] konsolebox: stability is very relative in my opinion
[13:30:07] drale2k_: has joined #ruby
[13:37:51] jottr: has joined #ruby
[13:48:16] suukim: has joined #ruby
[13:53:23] mtkd: has joined #ruby
[13:54:31] graphene: has joined #ruby
[14:00:47] riton: has joined #ruby
[14:01:54] Asher: has joined #ruby
[14:04:34] riton: hi guys, I'm trying to use a 'gem' installed with 'gem install -i /path/to/directory mygem' in this script https://pastebin.com/G1mNzdBJ . With ruby 2.2.x or ruby 2.3.1p112 (Ubuntu 16.04 version) this works. With ruby 2.4.x or 2.5.x this does not seem to work. How can I achieve this in those ruby versions ? Thanks
[14:04:35] ruby[bot]: riton: 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
[14:06:00] riton: code reposted here https://gist.github.com/riton/21465ee4b23d50ab55e67cbb4ba76d20 to satisfy the ruby bot :)
[14:07:36] Nomekrax: has joined #ruby
[14:09:19] cyberg: has joined #ruby
[14:10:58] beefjoe: has joined #ruby
[14:11:08] kryptoz: has joined #ruby
[14:15:55] darix: riton: try Gem.path << '/path/to/directory'
[14:17:19] jottr: has joined #ruby
[14:18:31] amar_: has joined #ruby
[14:19:43] za1b1tsu: has joined #ruby
[14:20:29] mupt: has joined #ruby
[14:22:05] chkhanch: has joined #ruby
[14:23:31] wilbert: has joined #ruby
[14:26:57] kryptoz: has joined #ruby
[14:27:57] _lyte_: has joined #ruby
[14:28:20] kurko_: has joined #ruby
[14:28:38] zapata: has joined #ruby
[14:29:55] drale2k_: has joined #ruby
[14:35:14] chkhanch: Hello everyone, I am looking for a Russian-speaking mentor :) I will be grateful for the feedback :)
[14:39:41] kryptoz: has joined #ruby
[14:41:01] amar_: has joined #ruby
[14:42:08] spiette: has joined #ruby
[14:43:07] hinbody: has joined #ruby
[14:43:18] hinbody: has left #ruby: ()
[14:44:26] akaiiro: has joined #ruby
[14:46:12] Es0teric: has joined #ruby
[14:52:03] fredlinhares: has joined #ruby
[14:53:24] jottr: has joined #ruby
[14:55:08] BloopMonster: has joined #ruby
[14:58:50] spiette: has joined #ruby
[14:58:55] riton: has joined #ruby
[15:00:19] AndroidKitKat: has joined #ruby
[15:00:54] rawste: has joined #ruby
[15:02:20] za1b1tsu: has joined #ruby
[15:05:17] AndroidKitKat: Hi, I'm pretty new to Ruby and programming in general. I'm just curious if Ruby is a good first OOP language. I know python and a smidge of C, but people keep telling me to try Ruby.
[15:05:42] AndroidKitKat: Basically, if I've never done OOP before, will there be issues with picking up Ruby
[15:06:08] RougeR: has joined #ruby
[15:06:09] RougeR: has joined #ruby
[15:09:03] moei: has joined #ruby
[15:09:14] wilbert: has joined #ruby
[15:09:16] solocshaw: has joined #ruby
[15:09:51] tdy: has joined #ruby
[15:12:15] chkhanch: <AndroidKitKat> it depends entirely on you :)
[15:13:13] lucasr: has joined #ruby
[15:13:15] AndroidKitKat: I've mainly done python, which isn't OOP more or less, but at the same time my python code is poorly written C just in python
[15:15:08] scrptktty: has joined #ruby
[15:15:35] chkhanch: very sad story :)
[15:16:15] fredlinhares: has joined #ruby
[15:16:54] Zaab1t: has joined #ruby
[15:18:16] lele: has joined #ruby
[15:19:39] _whitelogger: has joined #ruby
[15:20:25] AndroidKitKat: Well, I hope I can learn it properly :3
[15:21:13] chkhanch: do not worry, everything will be ok
[15:21:32] chkhanch: just do it )
[15:22:41] chouhoulis: has joined #ruby
[15:22:52] nfsnobody: has joined #ruby
[15:23:34] konsolebox: AndroidKitKat: i highly recommend you install and use `pry`
[15:24:10] AndroidKitKat: is it like a GDB for ruby?
[15:24:57] AndroidKitKat: also, dont know if this matters, but a lot of my development will be done on Windows
[15:25:16] mupt: has joined #ruby
[15:25:20] konsolebox: AndroidKitKat: it's like a shell so you can try execute simple Ruby syntax
[15:25:52] AndroidKitKat: So kinda like the python interpreter?
[15:26:09] AndroidKitKat: will install it
[15:26:14] fredlinhares: has joined #ruby
[15:27:02] m1st3rwr0ng: has joined #ruby
[15:28:16] caleBOT: has joined #ruby
[15:28:49] Fernando-Basso_: has joined #ruby
[15:28:54] karapetyan: has joined #ruby
[15:28:58] konsolebox: AndroidKitKat: like pyshell maybe
[15:29:25] amar_: has joined #ruby
[15:29:25] BTRE: has joined #ruby
[15:29:31] AndroidKitKat: thanks, that makes testing snippets of where im trying to learn easier than just making a file and doing `ruby $file.rb` everytime
[15:31:02] konsolebox: AndroidKitKat: are you using and installer from here? https://rubyinstaller.org/downloads/. i suggest you install one with devkit, and if you're using a 64-bit windows, install the 64bit one. e.g. https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.1-2/rubyinstaller-devkit-2.5.1-2-x64.exe
[15:31:24] AndroidKitKat: I did use the devkit one, and the 64bit windows one
[15:32:16] amar_: has joined #ruby
[15:32:33] konsolebox: you would have less problems installing gems
[15:32:48] drale2k_: has joined #ruby
[15:32:52] mattb20: has joined #ruby
[15:33:01] konsolebox: AndroidKitKat: i suggest this as a reference for Ruby's modules and classes: https://ruby-doc.org/core-2.5.1/
[15:33:29] mattb20: Please could somebody help me regarding rspec, using doubles and stubs https://gist.github.com/mattb20/c50851f5b3abe7ef0ada62af7d800136, this code and spec is giving me TypeError: no implicit conversion of Array into Integer on line 5, wtf!?
[15:35:49] sphenxes: has joined #ruby
[15:38:07] fredlinhares: has joined #ruby
[15:40:14] konsolebox: mattb20: i haven't coded in rspec yet. i only used minitest. can you make it more complete so i can run it here as well? i'm not sure how to set it up, like what 'require' line to add for rspec stuff.
[15:42:36] konsolebox: mattb20: basically the idea to find the problem is to verify what type of objects those variables contain. e.g. you place `puts "bank.class: #{bank.class}"; puts "bank.transaction_history: #{bank.transaction_history}"; bank.transaction_history.each do |transaction| puts "transaction: #{transaction}"; puts transaction.join( ' || '); end
[15:46:00] mattb20: thanks @konsolebox here https://gist.github.com/mattb20/6eb5e9a388e356dc6be7a45f9e09ed5d is the complete code, spec file on top, class file below it
[15:52:45] lidenbrock: has joined #ruby
[15:59:33] anisha: has joined #ruby
[16:00:01] tolerablyjake: has joined #ruby
[16:00:07] alem0lars: has joined #ruby
[16:03:30] mattb20: has joined #ruby
[16:04:20] SeepingN: has joined #ruby
[16:06:30] amar_: has joined #ruby
[16:06:35] HashNuke: has left #ruby: ()
[16:10:44] pauliesaint: has joined #ruby
[16:11:28] konsolebox: mattb20: you seem to have gone offline. i can't test it: `require': cannot load such file -- printer (LoadError)
[16:11:56] chouhoulis: has joined #ruby
[16:12:34] apeiros: has joined #ruby
[16:12:57] mattb20: ive tried debugging it with puts statement and the object I want is going there
[16:13:01] mattb20: and i've tested the method in IRB
[16:13:11] mattb20: it's like it's getting lost somewhere
[16:13:20] drale2k_: has joined #ruby
[16:13:28] mattb20: sorry maybe my gist wasn't clear
[16:13:29] konsolebox: mattb20: like this? https://bpaste.net/show/bfd3b364c16c
[16:14:08] mattb20: https://gist.github.com/mattb20/9090ecdb3d4927b0e34132e52718cf5e
[16:14:24] mattb20: that's the two separate files, I'm trying it without mocks and stubs now so you'd have to mock bank
[16:16:22] mattb20: it's something to do with the method because everyone is correct until the each do loop
[16:16:34] mattb20: but what I don't understand is I've tested it in IRB and it works how i'd like it too
[16:17:52] konsolebox: if you think it should completely work, maybe the problem is in the describe stuff
[16:19:24] konsolebox: and i'd also debug that part if i were you
[16:20:44] Alayde: has joined #ruby
[16:22:34] dionysus69: has joined #ruby
[16:22:59] anisha: has joined #ruby
[16:23:22] jcarl43: has joined #ruby
[16:23:42] mattb20: thank you you were right
[16:23:43] apeiros: has joined #ruby
[16:23:46] mattb20: I hadn't defined the stub properly
[16:23:51] Lytol: has joined #ruby
[16:25:55] [Butch]: has joined #ruby
[16:26:06] darkhanb: has joined #ruby
[16:28:28] caleBOT: has joined #ruby
[16:29:06] AndroidKitKat: Hey, so I'm trying out the Try Ruby online quickstart, and I have a few questions
[16:29:33] AndroidKitKat: in the "Are you Harsh" section from the link here: https://ruby.github.io/TryRuby/
[16:29:56] AndroidKitKat: It has me do this https://www.irccloud.com/pastebin/Pa3rCHHE/
[16:29:57] ruby[bot]: AndroidKitKat: we in #ruby do not like irccloud.com, it has no syntax highlighting, distracting formatting and loads slowly for most. Please use https://gist.github.com
[16:30:04] mynameisdebian: has joined #ruby
[16:30:48] AndroidKitKat: https://gist.github.com/AndroidKitKat/0e281ab1861693d665a985a653c991a7
[16:30:50] fmcgeough: has joined #ruby
[16:31:26] AndroidKitKat: So, if I understand correctly, Line 1, just obviously makes me a new has
[16:31:50] elomatreb: Line 1 is where pretty much all the magic happens in this specific example
[16:31:57] AndroidKitKat: line 3 and 4 is what is confusing
[16:32:09] AndroidKitKat: i understand that for each of the values in books do something
[16:32:34] elomatreb: Right, the block (the part between { and }) is run once for each value from books
[16:32:35] AndroidKitKat: but what is that thing I'm doing, and why am I incrementing by one?
[16:33:00] AndroidKitKat: the output looks like: {"splendid"=>1, "abyssmal"=>1, "mediocre"=>2}
[16:33:03] mattb20: you'll need to look up the hash for that answer
[16:33:28] elomatreb: That depends on the setting of your example. You're effectively counting how often each value in books occurs
[16:33:40] mattb20: ratings[rate] this is a key for the ratings hash that will access a specific value
[16:34:22] elomatreb: (Where rate is the current value from books for which the block is run)
[16:34:31] AndroidKitKat: so, for each type of rating, put it into the ratings hash and then add one to that total?
[16:35:08] konsolebox: "add one to the current value"
[16:35:12] elomatreb: You don't need to put it into the Hash as you defined a default value in line one
[16:35:19] kryptoz: has joined #ruby
[16:35:36] konsolebox: >> h = {}; h[:rate] = 0; h[:rate] += 1; h[:rate]
[16:35:37] ruby[bot]: konsolebox: # => 1 (https://eval.in/1032304)
[16:35:38] elomatreb: The default value gets used when you try to access a key that doesn't exist, and since += assigns it will create the key
[16:35:50] AndroidKitKat: so line one creates a new hash, ratings, where every new value is set to 0?
[16:36:14] AndroidKitKat: This feels different than python, but a good different
[16:36:38] elomatreb: Yep. More correctly, it runs the block (the curly braces) each time you access an undefined key and uses its return value, you can do anything in it
[16:37:29] elomatreb: For an exhaustive overview of what Hash.new can do: https://ruby-doc.org/core-2.5.1/Hash.html#method-c-new
[16:37:56] AndroidKitKat: so it isnt iterating through the list, its finding all the values with a given name and doing that thing?
[16:38:36] elomatreb: It is iterating through the list, that's the .each part of line 3
[16:39:20] AndroidKitKat: but its only iterating for each unique value
[16:39:35] Es0teric: has joined #ruby
[16:39:41] AndroidKitKat: hashes are kinda weird for me at least to wrap my head arond
[16:39:43] wilbert: has joined #ruby
[16:39:48] konsolebox: AndroidKitKat: he's referring to books.values
[16:40:08] elomatreb: You are iterating over books.values, which is a plain Array
[16:40:31] elomatreb: Try inserting `p books.values` to see the data you're dealing with
[16:40:34] konsolebox: AndroidKitKat: the hash has unique keys, so "finding all the values with a given name" doesn't apply there
[16:42:39] AndroidKitKat: Maybe I'm just a little confused as to what keys are, they are what is returned when you do `books.values`?
[16:42:54] MagePsycho_: has joined #ruby
[16:43:12] sauvin_: has joined #ruby
[16:43:33] tdy: has joined #ruby
[16:43:53] elomatreb: I assume books is given by the example? It's probably a hash, which means it's a collection of key-value pairs where the keys are unique
[16:44:19] elomatreb: Calling .values on it goes through it and gives you all the values (without the keys) in a big list
[16:45:12] elomatreb: You said you know Python? Hashes are the Ruby equivalent of dictionaries
[16:45:25] AndroidKitKat: I'm still pretty green in python
[16:45:38] tty: has joined #ruby
[16:47:04] AndroidKitKat: So the keys are like unique things like people, or in this case books, and the values are like, in this case, something that can be applied to every key
[16:47:59] AndroidKitKat: so if you had different people, but wanted to put their hair colors in, you could do like john=>brown, amanda=> black, mike=>blonde, greg=> black
[16:48:13] AndroidKitKat: where the people are keys, and the values are the hair colors
[16:48:51] elomatreb: Pretty much, yeah
[16:49:06] AndroidKitKat: that makes more sense
[16:49:10] elomatreb: You can use any type of object as keys and values, e.g. strings and symbols are commonly used
[16:50:13] AndroidKitKat: Another question, you can ofc apply multiple values to a key
[16:50:29] AndroidKitKat: can you label those values like age, color, build etc?
[16:51:08] elomatreb: Just assigning different values to a single key overwrites, so to actually store multiple values you'd need to use an array as the value
[16:51:31] caleBOT_: has joined #ruby
[16:51:34] elomatreb: You can also nest Hashes, but at a certain point it makes more sense to construct a proper class for your objects
[16:51:59] AndroidKitKat: ACTION has a lot to learn
[16:54:48] Nicmavr: has joined #ruby
[16:55:43] apeiros: has joined #ruby
[16:56:52] graphene: has joined #ruby
[17:00:09] claudiuinberlin: has joined #ruby
[17:00:21] _aeris_: has joined #ruby
[17:01:04] MagePsycho_: has joined #ruby
[17:02:20] amar_: has joined #ruby
[17:03:03] za1b1tsu: has joined #ruby
[17:05:35] motstgo: has joined #ruby
[17:05:39] bsamorim: has joined #ruby
[17:06:48] kurko_: has joined #ruby
[17:07:42] gr33n7007h: has joined #ruby
[17:11:17] AndroidKitKat: For those here, do you omit the parens in most cases?
[17:11:27] AndroidKitKat: I feel wrong when I omit them
[17:17:27] bradleyprice: has joined #ruby
[17:17:31] konsolebox: AndroidKitKat: personally no if it feels like i'm executing a command, but no otherwise, especially when it's returning values.
[17:17:53] konsolebox: AndroidKitKat: (i was talking about methods)
[17:18:26] konsolebox: AndroidKitKat: sorry, i mean personally yes ...
[17:18:33] konsolebox: got confused with the negation there
[17:18:35] AndroidKitKat: I was a bit curious
[17:18:41] AndroidKitKat: but that makes sense
[17:18:47] AndroidKitKat: I'm just not used to leaving them off
[17:18:53] AndroidKitKat: but im glad I can include them
[17:20:21] bsamorim: has joined #ruby
[17:21:02] rshetty: has joined #ruby
[17:21:24] armyriad: has joined #ruby
[17:30:47] graphene: has joined #ruby
[17:34:38] pauliesaint: has joined #ruby
[17:36:05] vindvaki: has joined #ruby
[17:37:47] Es0teric: has joined #ruby
[17:38:55] mynameisdebian: has joined #ruby
[17:40:26] r29v: has joined #ruby
[17:44:27] sameerynho: has joined #ruby
[17:47:51] fmcgeough: has joined #ruby
[17:49:12] pauliesaint: has joined #ruby
[17:50:53] rshetty: has joined #ruby
[17:55:20] eckhardt_: has joined #ruby
[17:56:17] naftilos76: has joined #ruby
[17:57:53] cthulchu: folks, is there something in minitest that...
[17:58:16] cthulchu: that has a way to making it possible to pause a test and resuming it via a hotkey in browser
[17:58:23] cthulchu: in the testing browser
[17:58:34] cthulchu: I don't think so
[17:58:50] cthulchu: I mean, I believe I could make it to do so with a bit of hacking around
[17:58:58] cthulchu: but no native solutions
[18:06:17] nowhereman_: has joined #ruby
[18:07:43] kobain: has joined #ruby
[18:08:25] StarSeed0000: has joined #ruby
[18:10:23] roamingdog: has joined #ruby
[18:10:46] nowhere_man: has joined #ruby
[18:14:32] samosaphile: has joined #ruby
[18:16:07] fmcgeough: has joined #ruby
[18:18:55] leitz: has joined #ruby
[18:21:08] zachk: has joined #ruby
[18:22:11] zachk: has joined #ruby
[18:24:18] FernandoBasso: has joined #ruby
[18:27:40] \void: has joined #ruby
[18:27:56] mtkd: has joined #ruby
[18:28:38] agent_white: has joined #ruby
[18:32:07] SuperLag: has joined #ruby
[18:33:47] konsolebox: cthulchu: i don't think that's easy. you can hack the source code of minitest maybe
[18:36:27] tag: has joined #ruby
[18:39:30] MagePsycho_: Can anyone explain me this code: on roles(:app), in: :sequence, wait: 1 do
[18:41:58] Eiam: reads like some dsl to me
[18:42:18] Eiam: also sounds like #RubyonRails
[18:43:08] TinkerT: has joined #ruby
[18:43:42] Eiam: MagePsycho_: as a guess, it enumerates whatever Roles (a model) exist in :app and then waits 1 (second?) and executes the do block
[18:44:04] cschneid: has joined #ruby
[18:44:06] Eiam: probably passing the role models in order to the block to do whatever with it
[18:46:31] Eiam: someone smarter than me could confirm but it might make more sense to read it as.. on(roles(:app), {in => :sequence}, {wait => 1})
[18:47:49] Eiam: I don't personally use first class support for keyword arguments
[18:49:28] clemens3: has joined #ruby
[18:53:28] BTRE: has joined #ruby
[18:54:46] jrich523: is im giving a "no confirm" param, is there a common name for that? i would use --confirm if the default was to not confirm, but in this case the default is to confirm
[18:54:46] bak1an: has joined #ruby
[18:55:06] jrich523: sorry, from a CLI standpoint
[18:56:43] jamesaxl: has joined #ruby
[18:56:46] amar_: has joined #ruby
[18:56:55] drale2k_: has joined #ruby
[18:59:13] za1b1tsu: has joined #ruby
[19:02:38] cozachk: has joined #ruby
[19:02:45] amar_: has joined #ruby
[19:09:39] pauliesaint: has joined #ruby
[19:10:19] guille-moe: has joined #ruby
[19:12:18] quobo: has joined #ruby
[19:16:29] cthulchu: I can have a listener on the site that listens to a hotkey and creates a variable when it occurs. I can sit in minitest and run lots of checks for that variable in browser
[19:16:46] cthulchu: when the variable is there, I can execute byebug from minitest
[19:16:56] amar_: has joined #ruby
[19:16:57] cthulchu: that will effectively pause the execution of the test
[19:17:16] cthulchu: allowing me to look in the browser's console and inspect things I'm interested in
[19:17:29] cthulchu: and then I'll be able to continue the test from the console
[19:21:32] shinnya: has joined #ruby
[19:23:24] bradleyprice: has joined #ruby
[19:27:49] apeiros: has joined #ruby
[19:29:51] vindvaki: has joined #ruby
[19:36:36] bsamorim: Is Ruby 2.5.1 stable?
[19:39:29] NL3limin4t0r: bsamorim: https://www.ruby-lang.org/en/downloads/ "Here you can get the latest Ruby distributions in your favorite flavor. The current stable version is 2.5.1."
[19:39:39] bsamorim: miah, NL3limin4t0r: thanks!
[19:40:41] mtkd: has joined #ruby
[19:42:27] bsamorim: is it common to implicitly use dependencies in Ruby code? I mean, if I require 'baz' and 'bar' in 'foo' (in that oreder) and I use 'baz' in 'bar', should I do "require 'baz'" in 'bar'?
[19:44:32] ramfjord: has joined #ruby
[19:45:44] ineb: bsamorim: it makes your intention clearer if you do so
[19:47:00] bsamorim: ineb: and requiring the same code twice is a gotcha-free situation?
[19:47:12] bsamorim: or should I be aware of something?
[19:47:14] duderono_: has joined #ruby
[19:50:58] bradleyp_: has joined #ruby
[19:52:25] NL3limin4t0r: AndroidKitKat: I'm a bit late to the party, but you can see hashes basicly as arrays with named indexes. In other languages you encounter them under the name "HashMap" or "Dict" (Dictionary).
[19:52:51] ineb: bsamorim: require avoids double loading, gotcha would be if you require the same file with different paths
[19:53:03] bsamorim: ineb: ok, thanks!
[19:53:19] ineb: bsamorim: like require './foo' and require '../lib/foo'
[19:53:29] AndroidKitKat: Thanks NL3limin4t0r
[19:53:41] NL3limin4t0r: Although they are a pair you can request an array of only the keys, or only the values. Which you are doing on line 3. By calling `books.values`
[19:53:41] bsamorim: got it, thanks!
[19:53:55] NL3limin4t0r: Than you loop through the array by calling `.each`
[19:54:55] NL3limin4t0r: AndroidKitKat: I don't know how new you are to programming but the `ratings[rate] += 1` is a shortcut for `ratings[rate] = ratings[rate] + 1`.
[19:55:11] Cthulu201: has joined #ruby
[19:55:19] motstgo_: has joined #ruby
[19:55:35] AndroidKitKat: I know that little trick, I guess I’m just used to writing C code in other languages, if that makes sense
[19:55:45] AndroidKitKat: When I write python it’s not very pythonic
[19:55:55] ineb: bsamorim: i have to take that back. i tested it and it doesnt get loaded twice. so different paths seem ok aswell
[19:56:00] AndroidKitKat: Which I’m trying to change with ruby
[19:56:28] jasmith: has joined #ruby
[19:58:08] NL3limin4t0r: If you have questions about certain classes or methods you find almost everyting explained at http://ruby-doc.org/core-2.5.1/
[19:58:10] Es0teric: has joined #ruby
[19:58:13] bsamorim: ineb: Yeah, that seemed rather arbitrary...thanks for the update!
[19:59:02] NL3limin4t0r: AndroidKitKat: If you don't know where to look you can just ask ruby. For example:
[19:59:08] amar: has joined #ruby
[19:59:09] claudiuinberlin: has joined #ruby
[19:59:39] NL3limin4t0r: >> books = {}; books.method(:values)
[19:59:39] ruby[bot]: NL3limin4t0r: # => #<Method: Hash#values> (https://eval.in/1032350)
[20:00:10] NL3limin4t0r: >> books = {}; books.values.method(:each)
[20:00:11] ruby[bot]: NL3limin4t0r: # => #<Method: Array#each> (https://eval.in/1032351)
[20:00:12] zenspider: I'm not sure how that's useful to a newb. Much more useful is realizing you have documentation locally
[20:00:26] zenspider: eg: `ri Hash`; `ri Hash.values`
[20:00:57] zenspider: (or even `ri values`)
[20:01:10] NL3limin4t0r: zenspider: But you first have to understand what value you call something on, otherwise you don't know where to look.
[20:02:38] zenspider: and teaching them #method helps with that? no.
[20:02:50] zenspider: >> books = {}; books.class # MIGHT be more useful
[20:02:51] ruby[bot]: zenspider: # => Hash (https://eval.in/1032354)
[20:03:04] NL3limin4t0r: zenspider: It outputs the class and method name.
[20:05:34] zenspider: so? Like you said, "you first have to understand what value [you have]" yet you want them to know the name of a method. That seems like a stretch to me.
[20:06:04] zenspider: knowing how to use irb, knowing ri, and knowing some basic methods like #class will let someone explore and poke around and learn on their own
[20:07:31] zenspider: >> books = {}; books.methods.first 5
[20:07:32] ruby[bot]: zenspider: # => [:<, :>, :<=, :>=, :==] (https://eval.in/1032359)
[20:07:41] zenspider: >> books = {}; books.methods.sample 5
[20:07:42] ruby[bot]: zenspider: # => [:respond_to?, :rassoc, :public_method, :is_a?, :default_proc=] (https://eval.in/1032360)
[20:08:51] zenspider: >> books = {}; books.class.public_instance_methods(false).sample 5
[20:08:51] ruby[bot]: zenspider: # => [:size, :inspect, :each_key, :reject!, :has_key?] (https://eval.in/1032361)
[20:09:07] zenspider: I have that aliased to #pim in my .irbrc
[20:11:02] bradleyprice: has joined #ruby
[20:14:35] Mike11: has joined #ruby
[20:15:25] mynameisdebian: has joined #ruby
[20:20:21] pauliesaint: has joined #ruby
[20:20:50] capitalsav: has joined #ruby
[20:22:11] capitalsav: Hello everybody!
[20:25:23] apeiros: has joined #ruby
[20:25:42] pauliesaint: has left #ruby: ()
[20:28:36] capitalsav: Please help me. I need to run cron task, which will execute my .rb file. I have tried to execute in terminal /home/capitalsav/.rvm/wrappers/ruby-2.4.0@test_cron/ruby /home/capitalsav/RubymineProjects/test_cron/test.rb - and it didnt work. But if I run this command in the directory of file, which I need to run: /home/capitalsav/.rvm/wrappers/ruby-2.4.0@test_cron/ruby test.rb - it works OK. But I need the first command execute successf
[20:29:07] capitalsav: Here is my crontab:
[20:29:08] capitalsav: 30 21 * * 4 /home/capitalsav/.rvm/wrappers/ruby-2.4.0@test_cron/ruby /home/capitalsav/RubymineProjects/test_cron/test.rb > /home/capitalsav/CRONOUTPUT.log 2> /home/capitalsav/CRONERROR.log
[20:32:34] SeepingN: set MAILTO="your@email.com" appropriately before that cron entry so it emails you any output
[20:32:52] SeepingN: most likely you have environment variables that need to be in place, and aren't when cron runs
[20:34:06] SeepingN: a quick n dirty is to source one or more of your dot files first. 30 21 * * 4 source /home/username/.bashrc; /original/stuff/goes here
[20:42:49] zenspider: it'll email the user on that machine by default if you don't...
[20:43:26] zenspider: capitalsav: when I'm having crontab issues, it's usually pathing that screws things up. But you have full paths to stuff
[20:43:45] zenspider: what I usually do is start a new BARE shell that doesn't have all my stuff confusing things. I use this:
[20:43:46] zenspider: alias newshell='env -i HOME=$HOME $SHELL --norc'
[20:43:56] SeepingN: paths and environment. but until you can see what's failing, it's hard to fix!
[20:44:27] zenspider: then just try running your command straight up
[20:44:57] zenspider: I would recommend getting off of rvm for this very reason tho. It's just the messiest thing ever
[20:45:19] MagePsycho_: has joined #ruby
[20:45:46] SeepingN: well you should be able to run "ruby" which should point to the latest. or some sort of magic.
[20:45:48] baweaver: zenspider: You see that RubyMine just got chruby support?
[20:45:55] baweaver: Should help with some of the fun shenanigans.
[20:46:04] baweaver: (at least for the crowd that uses it)
[20:46:29] AndroidKitKat: Is it normal for a .rb to end with a blank line?
[20:46:41] AndroidKitKat: my linter says there should be one
[20:46:45] zenspider: I have emacs set up to ALWAYS have a newline at the end... but not a blank line, no
[20:46:52] baweaver: Mostly a git thing iirc
[20:46:56] SeepingN: seems best not to end a line with only EOF
[20:47:11] AndroidKitKat: That makes sense
[20:47:17] baweaver: https://robots.thoughtbot.com/no-newline-at-end-of-file
[20:47:24] baweaver: Bingo, that has some history lessons on it too
[20:47:42] r29v: has joined #ruby
[20:47:50] zenspider: AndroidKitKat: sounds like your linter focuses on minutia
[20:48:01] zenspider: (as they do in the ruby world... kinda sad)
[20:49:34] zenspider: and by "end in a newline but not a blank line", I mean the file should end in "\n", but not "\n\n"
[20:50:09] AndroidKitKat: I just know that hitting return at the end of my line code made my linter happy
[20:50:27] SeepingN: also makes "wc -l" happy
[20:50:54] SeepingN: it counts carriage returns, so if the last one isn't there, you'll think your file is 1 line shorter than it kinda-is (if it had that \n)
[20:51:43] zenspider: AndroidKitKat: you should be focusing on more important things. Your "linter" is noise.
[20:51:57] AndroidKitKat: I should focus on writing good code lol
[20:52:06] AndroidKitKat: so far my ruby is very sad
[20:52:52] zenspider: your lint tool will probably not help with that. but we can.
[20:53:08] rikkipitt: has joined #ruby
[20:53:49] Eiam: yeah our advice is worth what it costs!
[20:53:58] AndroidKitKat: I tried installing pry, which was recommended earlier
[20:54:00] Eiam: I've Definitely Never Broken Production With My Code
[20:54:14] AndroidKitKat: But I don't know i'm using it properly
[20:54:32] stephenmac7: has joined #ruby
[20:54:35] Eiam: AndroidKitKat: I find the value of tools is easier to understand when you have a problem the tool solves, rather than just looking at tools in isolation
[20:54:41] zenspider: if you're a beginner, I recommend using irb and just focus on the code
[20:54:53] zenspider: bells and whistles just serve to confuse and distract until you're ready for them
[20:55:14] AndroidKitKat: Thats very true
[20:55:21] Eiam: so, write some ruby, get into some problems that some specialized tools can help you sort out.
[20:55:52] stephenmac7: Hey, I'm trying to add commas to numbers. I was wondering if s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, '\&,') or s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) { |x| "#{x}," } is more efficient
[20:56:03] Eiam: stephenmac7: whats the input
[20:56:33] stephenmac7: Eiam: An integer, but s = n.to_i
[20:56:46] Eiam: so like you have 1000 and you want 1,000 ?
[20:56:54] Eiam: what about if its european or otherwise?
[20:57:55] stephenmac7: In this case, I just need the fastest way to do it in american style
[20:58:36] Eiam: stephenmac7: well covered topic -- https://stackoverflow.com/questions/1078347/is-there-a-rails-trick-to-adding-commas-to-large-numbers
[20:58:45] Eiam: as well as some performance comparisons between the solutions
[20:58:46] iceden: has joined #ruby
[20:58:51] caleBOT: has joined #ruby
[20:58:56] Eiam: (note the link contains non rails solutions as well)
[20:59:00] zenspider: stephenmac7: to_s.reverse.gsub(...).reverse
[21:00:57] stephenmac7: The reverse and then un-reverse is better than the complicated regex above?
[21:00:57] zenspider: stephenmac7: but... you should also learn how to answer this question yourself. Using the benchmark class (stdlib) or better the benchmark-ips gem
[21:01:17] Eiam: I personally prefer to not write regex but, preference
[21:01:30] zenspider: a stupid simple benchmark answers this question objectively
[21:02:22] stephenmac7: zenspider: I'll try it
[21:04:37] BloopMonster: has joined #ruby
[21:06:15] zenspider: benchmark-ips takes a lot of work out of experiment design
[21:07:17] vindvaki: has joined #ruby
[21:10:18] stephenmac7: zenspider: Did it with the builtin benchmarking library
[21:10:41] stephenmac7: Apparently { |x| s = x.to_s; s.reverse!.gsub!(/...(?=.)/) { |x| "#{x}," }; s.reverse! } is the speediest
[21:11:41] Eiam: make sure you comment that line for the next poor fool
[21:11:49] Eiam: (yourself in 4 months)
[21:12:07] stephenmac7: Eiam: That was just for the benchmark
[21:12:10] stephenmac7: And so I could get it in one line for IRC.
[21:13:39] canurabus: has joined #ruby
[21:14:29] zenspider: stephenmac7: don't use bang methods when you don't have to
[21:14:45] zenspider: s.reverse.gsub.reverse
[21:14:59] kvda: has joined #ruby
[21:19:20] canurabus: Hi all. I'm completely new to ruby (but not programming). Having a bit of trouble with some syntax. I see the following line in a class definition: "validates :title, :presence => true, :length => { :minimum => 5 }"
[21:19:49] zenspider: canurabus: *nod* what's the problem for you?
[21:19:55] canurabus: Is the correct interpretation: call a class method "validates" with the arguments (:title, {:presence => true}, {:length => {:minimum => 5}})
[21:20:32] zenspider: canurabus: not quite. One hash (w/ an inner hash)
[21:20:47] zenspider: :presence and :length are in the same hash
[21:21:46] zenspider: >> "abc".gsub!(/x/, "")
[21:21:47] ruby[bot]: zenspider: # => nil (https://eval.in/1032431)
[21:21:54] zenspider: stephenmac7: ^^^
[21:22:16] mikecmpbll: has joined #ruby
[21:22:34] zenspider: and you don't need the fastest. You need "fast enough" + "clearest"
[21:22:40] zenspider: this will not be your bottleneck
[21:23:04] canurabus: zenspider, thanks! how can you tell that the comma is not separating arguments to the validates function?
[21:23:27] canurabus: (vs multiple kv pairs in the same hash I guess)
[21:23:33] ur5us: has joined #ruby
[21:23:56] zenspider: canurabus: because ruby only allows for one implicit hash arg. adjacent k=>v pairs are one hash
[21:26:21] cthulchu: has joined #ruby
[21:27:52] jcarl43: has joined #ruby
[21:27:59] kobain: has joined #ruby
[21:28:53] hfp_work: has joined #ruby
[21:30:30] stephenmac7: zenspider: Checked and the bangs make it slightly faster. The fact that gsub! returns nil is really annoying. Unfortunately, one of the largest eaters of memory in my application seems to be this method. It's being called extremely often.
[21:31:12] stephenmac7: I'm honestly a fan of immutability, but in this case, it's a problem.
[21:31:57] stephenmac7: zenspider: Are there any other reasons not to use the bang methods other than the usual mutability is a problem considerations?
[21:32:12] Eiam: "Last parameter is always a hash"
[21:32:12] stephenmac7: I am creating a new string by using #to_s in this case
[21:36:50] bjpenn: has joined #ruby
[21:37:09] edwardly: has joined #ruby
[21:37:09] edwardly: has joined #ruby
[21:42:24] RougeR: has joined #ruby
[21:42:25] RougeR: has joined #ruby
[21:47:54] noobineer: has joined #ruby
[21:51:13] clemens3: has joined #ruby
[21:54:19] GodFather: has joined #ruby
[21:56:28] bradleyprice: has joined #ruby
[21:58:46] hfp_work: has joined #ruby
[22:00:07] amar_: has joined #ruby
[22:03:29] ramfjord: has joined #ruby
[22:12:50] amar: has joined #ruby
[22:15:54] graphene: has joined #ruby
[22:27:49] nicht: has joined #ruby
[22:28:19] mynameisdebian: has joined #ruby
[22:30:08] kilgore: has joined #ruby
[22:31:45] cagomez: has joined #ruby
[22:32:00] jasmith: has joined #ruby
[22:35:27] bradleyprice: has joined #ruby
[22:40:56] ramfjord: has joined #ruby
[22:48:59] bradleyprice: has joined #ruby
[22:50:53] raynold: has joined #ruby
[22:52:23] nicht_: has joined #ruby
[22:58:06] nicht: has joined #ruby
[22:58:42] caleBOT_: has joined #ruby
[23:01:15] cagmz: has joined #ruby
[23:02:09] DTZUZO: has joined #ruby
[23:02:18] Hexafox[I]: has joined #ruby
[23:07:15] SeepingN_: has joined #ruby
[23:08:55] dreamthese: has joined #ruby
[23:10:47] graphene: has joined #ruby
[23:11:24] apeiros: has joined #ruby
[23:13:53] zenspider: I missed that message... but my explanation is above.
[23:21:53] edwardly: has joined #ruby
[23:21:54] edwardly: has joined #ruby
[23:23:04] bradleyprice: has joined #ruby
[23:23:47] punnie: has joined #ruby
[23:57:00] bak1an: has joined #ruby
[23:57:42] ramfjord: has joined #ruby