« Back to channel list

#ruby - 11 March 2018

« Back 1 day Forward 1 day »
[00:02:58] orbyt_: has joined #ruby
[00:03:53] willmichael: has joined #ruby
[00:04:34] jordanm: has joined #ruby
[00:05:06] alfiemax: has joined #ruby
[00:11:08] Freshnuts: has joined #ruby
[00:13:28] cschneid: has joined #ruby
[00:14:19] sauvin_: has joined #ruby
[00:17:07] houhoulis: has joined #ruby
[00:17:10] AJA4350: has joined #ruby
[00:18:35] Psybur: has joined #ruby
[00:19:37] houhoulis: has joined #ruby
[00:22:23] alfiemax: has joined #ruby
[00:23:29] willmichael: has joined #ruby
[00:36:00] workmad3: has joined #ruby
[00:38:37] BaD_CrC: has joined #ruby
[00:39:35] alfiemax: has joined #ruby
[00:40:12] mtkd: has joined #ruby
[00:40:29] bigblind: has joined #ruby
[00:42:22] cschneid: has joined #ruby
[01:00:36] alfiemax: has joined #ruby
[01:04:29] x0F: has joined #ruby
[01:05:03] orbyt_: has joined #ruby
[01:17:43] cschneid: has joined #ruby
[01:34:28] alfiemax: has joined #ruby
[01:34:32] GinoMan: has joined #ruby
[01:47:38] alfiemax: has joined #ruby
[01:52:57] kapil___: has joined #ruby
[02:00:03] arescorpio: has joined #ruby
[02:00:21] alfiemax: has joined #ruby
[02:13:24] alfiemax: has joined #ruby
[02:15:42] isg: has joined #ruby
[02:16:32] x0F: has joined #ruby
[02:22:08] cschneid: has joined #ruby
[02:24:57] dinfuehr: has joined #ruby
[02:36:01] mniip: has joined #ruby
[02:36:25] alfiemax: has joined #ruby
[02:36:27] workmad3: has joined #ruby
[02:36:50] alfiemax: has joined #ruby
[02:40:40] cdg: has joined #ruby
[02:45:01] Guest74: has joined #ruby
[02:49:38] gizmore: has joined #ruby
[02:50:20] mozzarella: wassup bruhhhh
[02:51:09] Guest74: can tu test my program?
[02:51:33] mozzarella: what does it do
[02:52:04] Guest74: https://github.com/jonathanburgossaldivia/LANping mozzarella
[02:52:21] sauvin_: has joined #ruby
[02:58:37] sammi`: has joined #ruby
[02:58:40] Guest74: mozzarella
[03:00:46] apparition: has joined #ruby
[03:00:57] Guest74_: has joined #ruby
[03:03:24] JonaBurgos: mozzarella it's an automated ping
[03:05:50] weaksauce: you should hardly ever need to use to_i
[03:06:41] JonaBurgos: Okay, it's my first program weaksauce
[03:07:08] JonaBurgos: weaksauce: Did it work well?
[03:07:19] weaksauce: i didn't try it but just looked at it
[03:07:30] JonaBurgos: weaksauce: ok
[03:07:44] weaksauce: just a few thoughts: typical ruby is indented 2 spaces
[03:07:51] weaksauce: array.new is not usually used
[03:08:09] weaksauce: same with hash.new
[03:08:17] nowhere_man: has joined #ruby
[03:08:24] weaksauce: unless you need a default when you have a missing key
[03:09:56] JonaBurgos: @a = {} or @ b = []
[03:10:27] weaksauce: @mi_array.each on line 78 is not doing anything
[03:11:03] JonaBurgos: weaksauce: Wow, I will connect more often here, everything learned from Google
[03:12:27] JonaBurgos: weaksauce: ok, if I do not occupy that line the result is 0
[03:12:45] JonaBurgos: Found 0 host(s) in 3.116 seconds | Range: 1-255 | Timeout: 1.
[03:13:13] weaksauce: actually yeah that does do something my bad
[03:14:41] weaksauce: not a bad first go at it JonaBurgos though. not idiomatic ruby but it looks like it would work
[03:15:14] JonaBurgos: weaksauce: it works
[03:15:55] JonaBurgos: weaksauce: Do you know a lot about Ruby?
[03:16:05] weaksauce: i know a decent bit sure
[03:16:17] JonaBurgos: weaksauce ok
[03:16:58] weaksauce: there are many in here that know a lot more about ruby than me though
[03:16:59] JonaBurgos: in a program I need to clean the html code and just leave the url
[03:17:24] jshjsh: has joined #ruby
[03:17:36] JonaBurgos: example: href="www.google.com/a/b/c" </>. ...
[03:18:00] JonaBurgos: to : www.google.com/a/b/c"
[03:18:29] JonaBurgos: weaksauce Can that be done with pure ruby?
[03:18:56] JonaBurgos: weaksauce With Perl you can
[03:19:40] JonaBurgos: Perl is very complete when it comes to editing strings
[03:20:24] willmichael: has joined #ruby
[03:20:54] weaksauce: sure ruby can do that
[03:21:24] JonaBurgos: weaksauce: How can I clean that example line, would you show me?
[03:21:42] JonaBurgos: only this: href="www.google.com/a/b/c" </>
[03:23:56] weaksauce: >>x="href=\"www.google.com/a/b/c\" </>" x.sub(/href="([^"]*).*/, '\1')
[03:23:57] ruby[bot]: weaksauce: # => /tmp/execpad-cca3659eb3c4/source-cca3659eb3c4:2: syntax error, unexpected tIDENTIFIER, expecting key ...check link for more (https://eval.in/969748)
[03:24:12] drewmcmillan: has joined #ruby
[03:24:30] weaksauce: >>x='href="www.google.com/a/b/c" </>'; x.sub(/href="([^"]*).*/, '\1')
[03:24:31] ruby[bot]: weaksauce: # => "www.google.com/a/b/c" (https://eval.in/969749)
[03:24:58] weaksauce: many paths to rome though
[03:26:52] JonaBurgos: hahah very good weaksauce
[03:27:30] JonaBurgos: weaksauce: Where can I learn that?
[03:28:28] weaksauce: not sure really, just have to keep learning. look up regular expressions and see how ruby does them
[03:29:09] weaksauce: once you know that you can usually find a way to use them to manipulate text. read the docs on strings to see what they offer
[03:33:17] bigblind: has joined #ruby
[03:34:17] cschneid: has joined #ruby
[03:35:55] JonaBurgos: weaksauce: in Perl is: $x =~ s/(href=\"|\".*)//g
[03:36:48] weaksauce: that probably works in ruby too. ruby is a lot like perl
[03:37:57] JonaBurgos: weaksauce: I mainly use Ruby but I do not know how to edit text that simple
[03:38:16] JonaBurgos: weaksauce: hopefully
[03:38:49] JonaBurgos: weaksauce: Surely someone here knows, I'll connect tomorrow
[03:39:54] JonaBurgos: weaksauce: thanks for the demo :)
[03:40:27] JonaBurgos: Goodnight everyone
[03:45:53] Azure: has joined #ruby
[03:51:13] _whitelogger: has joined #ruby
[03:56:03] jenrzzz: has joined #ruby
[03:56:03] jenrzzz: has joined #ruby
[03:56:30] mrush: has joined #ruby
[04:02:24] nadir: has joined #ruby
[04:03:31] JonasSteiner: has joined #ruby
[04:03:40] JonasSteiner: weaksauce: hi
[04:04:08] weaksauce: hello JonasSteiner
[04:04:35] JonasSteiner: weaksauce: try this in irb
[04:04:40] JonasSteiner: a= 'href="www.google.com/a/b/c" </>'
[04:04:52] JonasSteiner: a = a.gsub(/href=\"|".*$/, "")
[04:06:43] JonasSteiner: weaksauce: well now if I sleep, good night
[04:11:51] cschneid: has joined #ruby
[04:14:22] alfiemax: has joined #ruby
[04:15:43] jenrzzz: has joined #ruby
[04:18:49] webhat: has joined #ruby
[04:20:00] modin: has joined #ruby
[04:22:03] Frem: has joined #ruby
[04:22:52] sandroqz: has joined #ruby
[04:23:37] BTRE: has joined #ruby
[04:24:28] netherwolfe: has joined #ruby
[04:24:57] sandroqz: has joined #ruby
[04:25:15] trautwein: has joined #ruby
[04:26:56] sandroqz: has joined #ruby
[04:35:16] jenrzzz: has joined #ruby
[04:35:16] jenrzzz: has joined #ruby
[04:36:52] workmad3: has joined #ruby
[04:49:40] Dimik: has joined #ruby
[04:59:59] gix-: has joined #ruby
[05:01:30] r3m: has joined #ruby
[05:03:05] motstgo: has joined #ruby
[05:05:46] cagomez: has joined #ruby
[05:10:58] alfiemax: has joined #ruby
[05:11:25] jeffreylevesque_: has joined #ruby
[05:14:27] Flisk: has joined #ruby
[05:17:23] darkhanb: has joined #ruby
[05:17:34] c0ncealed: has joined #ruby
[05:25:21] psmolen: has joined #ruby
[05:26:53] guardianx: has joined #ruby
[05:27:34] cschneid: has joined #ruby
[05:27:57] jeffreylevesque_: has joined #ruby
[05:30:51] psmolen: has joined #ruby
[05:47:36] cdg: has joined #ruby
[05:56:23] psmolen: has joined #ruby
[05:56:41] cschneid: has joined #ruby
[05:56:53] milardovich: has joined #ruby
[06:03:05] alfiemax_: has joined #ruby
[06:08:25] cdg: has joined #ruby
[06:08:25] nowhereman_: has joined #ruby
[06:23:53] Gnut_: has joined #ruby
[06:35:48] jenrzzz: has joined #ruby
[06:35:48] jenrzzz: has joined #ruby
[06:37:20] workmad3: has joined #ruby
[06:39:01] thinkpad: has joined #ruby
[06:41:16] reber: has joined #ruby
[06:49:24] dionysus69: has joined #ruby
[06:49:38] sammi`: has joined #ruby
[06:53:02] phaul: has joined #ruby
[06:56:45] Ryzokuken: has joined #ruby
[06:58:22] bigblind: has joined #ruby
[07:07:11] cschneid: has joined #ruby
[07:42:13] _aeris_: has joined #ruby
[07:43:03] jnollette: has joined #ruby
[07:43:52] jenrzzz: has joined #ruby
[07:43:52] jenrzzz: has joined #ruby
[07:47:25] claudiuinberlin: has joined #ruby
[07:48:51] cschneid: has joined #ruby
[08:02:22] BH23: has joined #ruby
[08:07:02] BH23: has joined #ruby
[08:07:46] _joes_: has joined #ruby
[08:13:35] alex``: has joined #ruby
[08:23:31] BH23: has joined #ruby
[08:25:56] cschneid: has joined #ruby
[08:28:03] gh: has joined #ruby
[08:29:10] cdg: has joined #ruby
[08:33:40] gh: has left #ruby: ("Leaving")
[08:35:24] jenrzzz: has joined #ruby
[08:37:45] workmad3: has joined #ruby
[08:42:08] ams__: has joined #ruby
[08:43:06] marr: has joined #ruby
[08:45:18] Megamosaren: has joined #ruby
[08:48:54] biberu: has joined #ruby
[08:54:19] suukim: has joined #ruby
[08:54:36] alfiemax: has joined #ruby
[08:58:43] Ryzokuken: has joined #ruby
[08:59:09] clemens3: has joined #ruby
[09:04:37] motstgo: has joined #ruby
[09:12:29] netherwolfe: has joined #ruby
[09:14:31] mikecmpbll: has joined #ruby
[09:18:38] im0nde_: has joined #ruby
[09:20:33] ltem: has joined #ruby
[09:20:44] alfiemax: has joined #ruby
[09:23:42] alfiemax_: has joined #ruby
[09:36:13] schneider: has joined #ruby
[09:41:04] cschneid: has joined #ruby
[09:52:01] faces: has joined #ruby
[09:52:11] amatas: has joined #ruby
[09:52:46] bigblind: has joined #ruby
[09:54:32] alfiemax: has joined #ruby
[09:57:24] TinkerTyper: has joined #ruby
[09:57:58] n008f4g_: has joined #ruby
[10:00:08] willmichael: has joined #ruby
[10:12:05] shinnya: has joined #ruby
[10:12:42] mniip: has joined #ruby
[10:14:12] cschneid: has joined #ruby
[10:17:01] alfiemax: has joined #ruby
[10:22:06] postmodern: has joined #ruby
[10:31:51] morfin: i need help with Selenium - when i do @driver = Selenium::WebDriver.for driver where driver variable have value :firefox i get Net::ReadTimeout: Net::ReadTimeout exception any clue why?
[10:37:07] morfin: i see geckodriver starts but firefox not i guess i should start in headless mode?
[10:37:48] alfiemax: has joined #ruby
[10:38:09] workmad3: has joined #ruby
[10:42:46] norphex: has joined #ruby
[10:45:42] willmichael: has joined #ruby
[10:46:25] halbbalda: has joined #ruby
[10:48:44] schneider: has joined #ruby
[10:52:31] houhoulis: has joined #ruby
[10:53:34] jordanm: has joined #ruby
[10:56:33] alfiemax: has joined #ruby
[10:57:49] aufi: has joined #ruby
[10:57:59] c0ncealed: has joined #ruby
[11:07:32] desperek: has joined #ruby
[11:21:59] sameerynho: has joined #ruby
[11:25:08] tomphp: has joined #ruby
[11:25:28] jinie: has joined #ruby
[11:26:02] cschneid: has joined #ruby
[11:30:32] bigblind: has joined #ruby
[11:38:32] AJA4350: has joined #ruby
[11:43:39] alfiemax: has joined #ruby
[11:48:24] Mermaid: has joined #ruby
[11:49:07] morfin: does Selenium run isolated instances of Firefox?
[11:52:38] \void: has joined #ruby
[11:58:26] zipace: has joined #ruby
[12:01:50] mn3m: has joined #ruby
[12:02:42] dviola: has joined #ruby
[12:06:39] RougeR: has joined #ruby
[12:07:24] motstgo: has joined #ruby
[12:11:54] dionysus69: has joined #ruby
[12:14:30] Guest81558: has joined #ruby
[12:14:30] Guest81558: has joined #ruby
[12:19:48] tAn: has joined #ruby
[12:25:04] claudiuinberlin: has joined #ruby
[12:32:24] ziprar: has joined #ruby
[12:32:56] goatish: has joined #ruby
[12:34:22] drewmcmillan: has joined #ruby
[12:38:36] workmad3: has joined #ruby
[12:39:26] nowhere_man: has joined #ruby
[12:40:24] MasterOfDisaster: hey, is there a way to use DESTDIR with bundler? I'm having trouble using native dependencies for gems.
[12:40:51] Papierkorb: has joined #ruby
[12:40:57] Papierkorb: has left #ruby: ("Konversation terminated!")
[12:45:09] cdg: has joined #ruby
[12:46:56] cschneid: has joined #ruby
[12:51:33] konsolebox: has joined #ruby
[12:54:22] netherwolfe: has joined #ruby
[13:00:40] John_Ivan: has joined #ruby
[13:00:41] John_Ivan: has joined #ruby
[13:00:54] tomphp: has joined #ruby
[13:06:44] ggherdov: has joined #ruby
[13:08:22] motstgo: has joined #ruby
[13:08:41] suukim: has joined #ruby
[13:18:42] zipace: has joined #ruby
[13:19:42] mn3m: has joined #ruby
[13:22:11] bigblind: has joined #ruby
[13:26:36] tomphp: has joined #ruby
[13:27:12] cschneid: has joined #ruby
[13:27:35] tomphp: has joined #ruby
[13:28:58] tomphp: has joined #ruby
[13:31:28] _joes_: has joined #ruby
[13:35:48] rabajaj: has joined #ruby
[13:36:23] tomphp: has joined #ruby
[13:41:07] deadnull: has joined #ruby
[13:49:48] alfiemax: has joined #ruby
[13:53:54] NielsonRolim: has joined #ruby
[13:57:02] cdg: has joined #ruby
[14:00:20] kapil___: has joined #ruby
[14:03:37] cschneid: has joined #ruby
[14:06:53] biberu: has joined #ruby
[14:09:10] motstgo: has joined #ruby
[14:16:11] houhoulis: has joined #ruby
[14:17:38] nadir: has joined #ruby
[14:17:41] chouhoulis: has joined #ruby
[14:18:56] tomphp: has joined #ruby
[14:19:51] tomphp: has joined #ruby
[14:20:38] DLSteve: has joined #ruby
[14:22:14] tomphp: has joined #ruby
[14:23:50] tomphp: has joined #ruby
[14:28:20] rolim: has joined #ruby
[14:29:17] deadnull: has joined #ruby
[14:32:03] rolim: has joined #ruby
[14:32:58] desperek: can i ask here about ror?
[14:33:11] apeiros: ?rails desperek
[14:33:11] ruby[bot]: desperek: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[14:38:59] workmad3: has joined #ruby
[14:42:02] karapetyan: has joined #ruby
[14:43:53] xco: has joined #ruby
[14:44:15] xco: hi. is this "$%{price}" equivalent to “$#{price}" ?
[14:44:37] xco: i haven’t seend “%{}” before
[14:45:34] apeiros: &ri String#%
[14:45:34] `derpy: http://ruby-doc.org/core-2.4.1/String.html#method-i-25
[14:45:45] apeiros: it's not equivalent, no
[14:46:03] apeiros: #{} interpolates immediately. %{} is for String#%, sprintf and friends
[14:50:18] lroca: has joined #ruby
[14:53:11] bauruine: has joined #ruby
[14:53:13] xco: apeiros: thank you. but i’m looking at this: http://guides.rubyonrails.org/i18n.html#passing-variables-to-translations the way they us it is just “%{price}” but in the doc it’s always “string” % arg unlike how it’s used here http://guides.rubyonrails.org/i18n.html#passing-variables-to-translations for “price”
[14:53:21] xco: it’s not the same thing i guess
[14:53:31] apeiros: it's similar
[14:53:41] apeiros: you use the %{} vars in I18n.t
[14:54:34] Zaab1t: has joined #ruby
[14:55:50] envex: has joined #ruby
[14:57:38] lomex: has joined #ruby
[14:58:06] kt: has joined #ruby
[14:58:27] amatas: has joined #ruby
[15:00:10] drewmcmillan: has joined #ruby
[15:06:53] cschneid: has joined #ruby
[15:09:56] motstgo: has joined #ruby
[15:11:41] adlerdias: has joined #ruby
[15:14:30] SuperLag: has joined #ruby
[15:20:14] bigblind: has joined #ruby
[15:22:47] minimalism: has joined #ruby
[15:23:54] dionysus69: has joined #ruby
[15:40:18] dviola: has joined #ruby
[15:47:08] tomphp: has joined #ruby
[15:48:50] cschneid: has joined #ruby
[15:54:58] Mike11: has joined #ruby
[16:03:11] netherwolfe: has joined #ruby
[16:03:51] CodeBug: has joined #ruby
[16:04:00] cdg_: has joined #ruby
[16:05:24] nowhere_man: has joined #ruby
[16:17:55] tomphp: has joined #ruby
[16:22:01] AJA4350: has joined #ruby
[16:23:29] cschneid: has joined #ruby
[16:25:13] Puffball: has joined #ruby
[16:32:20] halbbalda: has joined #ruby
[16:32:28] ayonkhan: has joined #ruby
[16:35:36] adlerdias: has joined #ruby
[16:37:11] JonasSteiner: has joined #ruby
[16:37:46] opekktar: has joined #ruby
[16:37:54] opekktar: has left #ruby: ()
[16:38:26] adlerdias: has joined #ruby
[16:40:08] halbbalda: has joined #ruby
[16:47:09] howdoi: has joined #ruby
[16:50:50] halbbalda: has joined #ruby
[16:54:07] espressocannon: has joined #ruby
[16:54:48] aufi: has joined #ruby
[16:54:53] espressocannon: can somebody help me figure out why this is looping infinitely?
[16:54:54] espressocannon: https://gist.github.com/ELI7VH/4fe4e0673700c2fa293301baf9e90b32
[16:55:00] halbbalda: has joined #ruby
[16:55:49] espressocannon: my `return` statement doesn't seem to be exiting the function
[16:58:11] JonasSteiner: espressocannon: in no time you break the loop
[16:58:55] halbbalda: has joined #ruby
[16:59:01] espressocannon: shouldn't the if statement at the top level of the function break it out? or does it only break the current "layer"
[17:01:17] JonasSteiner: espressocannon: Well, I do not have much time to help you ... I'm currently working on a Python program
[17:01:53] havenwood: espressocannon: It is returning as you expect. The issue is that you're calling the recursive function 13 times.
[17:02:05] havenwood: espressocannon: roman_mapping.size #=> 13
[17:02:31] espressocannon: only if the number is divisible by the key
[17:03:02] cschneid: has joined #ruby
[17:03:11] havenwood: espressocannon: But for each element of the Hash, so if the first one is a match - you still do the second.
[17:03:12] havenwood: But it's the second without regard to the first having happened.
[17:03:33] havenwood: espressocannon: It seems to me like you more want to find the first that matches your criteria and call the recursive function.
[17:03:43] havenwood: Right now, the recursive function is getting called over and over again.
[17:03:59] havenwood: You're branching out more than intended.
[17:04:02] espressocannon: why would it be called if the condition is not met, though
[17:04:23] espressocannon: if (number / k) >= 1 should make it attempt the next key..
[17:04:33] havenwood: espressocannon: On the each loop, it's reusing `number` for each pair.
[17:05:12] havenwood: Since `number` isn't changing, it just keeps doing the same thing for each key value pair - which means a ton of recursive calls.
[17:05:48] espressocannon: but it shouldn't be recursing if that condition is not met
[17:06:00] espressocannon: it should ust be trying all the kv pairs
[17:06:12] espressocannon: then when it finds one, it recurses
[17:06:13] havenwood: espressocannon: Right, but it's not decrementing the number in the #each loop.
[17:06:32] havenwood: It's setting off a recursive call for *every* key value that matches the condition.
[17:06:33] espressocannon: it shouldn't be. it should only decrement when the condition is met
[17:06:36] havenwood: Not the first that matches.
[17:07:12] havenwood: Think of it this way, this #each loop *keeps going* after a successful recursive call: https://gist.github.com/ELI7VH/4fe4e0673700c2fa293301baf9e90b32#file-roman_algo-rb-L19
[17:07:16] havenwood: but it doesn't take into account any changes to `number`
[17:07:19] espressocannon: does it go loop until > condition > recurse > loop until > condition > recurse > return
[17:07:32] havenwood: espressocannon: Sorry, I see the issue but am having trouble explaining clearly pre-coffee >.>
[17:07:52] espressocannon: no problem i appreciate the help
[17:07:59] havenwood: It's basically working, but you're calling the recursive function way more times than you mean to, without number getting smaller.
[17:08:10] espressocannon: for the record. I do get theright result. but then it just keeps going
[17:08:43] havenwood: If you just found the first roman mapping that sufficed and did the recursive function, it'd work. But you're calling the recursive function over and over inside the iteration.
[17:09:01] espressocannon: https://gist.github.com/ELI7VH/9f07b9056381826a917fd56c84a54d48
[17:09:45] havenwood: espressocannon: So say `1000 => "M"` matches the condition, it calls the recursive function.
[17:10:10] havenwood: You then shouldn't iterate on to `900 => "CM"`, but you are!
[17:10:11] espressocannon: yes. with the new_number, which is number-1000
[17:10:33] espressocannon: why does it keep going if the recursion is calld?
[17:10:36] havenwood: So the recursive function happens (yay, that's what we want) AND you go on to the next key value pair.
[17:11:03] espressocannon: so do i like... break after the function?
[17:11:03] motstgo: has joined #ruby
[17:11:12] havenwood: The next pair `900 => "CM"` also matches the condition, and does it's own recursive call, and so on.
[17:11:15] espressocannon: recursion* is called
[17:11:31] havenwood: So instead of the first match doing the recursive call, it's doing it for *every* key value pair.
[17:11:59] havenwood: espressocannon: Because #each doesn't stop iterating when a recursive function is called.
[17:12:42] havenwood: So the `1000` was a match, it does the recursive call. You shouldn't *also* carry on and do the `900`.
[17:13:34] havenwood: espressocannon: You're not stopping your each iteration when you find a condition that matches, so you're doing the second smallest roman and third smallest etc, each acting like the previous hadn't happened.
[17:13:39] JonasSteiner: has joined #ruby
[17:14:09] espressocannon: i think iget it
[17:14:11] havenwood: espressocannon: To fix it, #find one that matches your condition, and recurse. Don't recurse after you find the match. Those are too small, and havent' taken into account that the larger was subtracted.
[17:14:28] havenwood: It's the each continuing on and starting a ton of recursions.
[17:14:37] espressocannon: ok so... here is what i did
[17:14:37] havenwood: The first one it finds it shouldn't keep going.
[17:14:43] espressocannon: return map_dat_roman(roman_mapping, new_number, result)
[17:15:07] espressocannon: so that exits the recursion with that function
[17:15:24] havenwood: you could break or return, yeah
[17:15:30] claudiuinberlin: has joined #ruby
[17:15:37] havenwood: really though, don't you want to #find rather than #each?
[17:15:45] espressocannon: so a "return" only "reutrns' a single recursion
[17:15:48] havenwood: (#each with a break on condition is like a #find)
[17:16:01] havenwood: espressocannon: yes, that would exit the iteration early
[17:16:13] havenwood: (which avoids the problem you're running into where you recurse more than intended)
[17:16:17] espressocannon: ok but, would i have to make a list of all the numbers and then find them?
[17:16:32] havenwood: are you familiar with #find?
[17:16:32] espressocannon: i thought ruby had an implicit return
[17:16:44] havenwood: it does have an implicit return - returns here are really not the issue
[17:16:57] espressocannon: but `map_dat_roman(roman_mapping, new_number, result)`
[17:17:06] espressocannon: should have acted as an implicit return right
[17:17:12] havenwood: you're just iterating through a collection and recursing more than intended
[17:17:20] espressocannon: putting `return` in front of that fixed the issue
[17:17:20] havenwood: you don't want to recurse for #each, you want to recurse for the first you #find
[17:17:26] jamesaxl: has joined #ruby
[17:18:07] espressocannon: because find stops once the condition is met
[17:18:33] tomphp: has joined #ruby
[17:19:11] espressocannon: im still getting used to all thedifferent methods in ruby. im about 2 weeks into learning rails, and I just started doing ruby quizzes yesterday to actually learn wtf is happening
[17:19:51] espressocannon: it still kind of puzzles me, but I think I get it, and a find would for sure make more .... efficient?
[17:23:39] espressocannon: thanks again. now go get some coffee, you savage.
[17:23:58] pmullins: has joined #ruby
[17:24:06] bigblind: has joined #ruby
[17:24:25] s3nd1v0g1us: has joined #ruby
[17:24:32] Axsuul: has joined #ruby
[17:25:49] espressocannon: oh wow. find is so much nicer
[17:26:11] espressocannon: https://gist.github.com/ELI7VH/d09b6c1296329ddeb5ee8dbb7861ccd0
[17:28:17] karapetyan: has joined #ruby
[17:29:32] havenwood: espressocannon: you're welcome!
[17:29:40] havenwood: yeah, that looks way better
[17:30:02] havenwood: espressocannon: then just get rid of those `return`s
[17:30:49] havenwood: A nice way to check `>= 1` is to use #positive?.
[17:31:01] havenwood: espressocannon: if number.positive?
[17:31:33] espressocannon: yeah. I just wanted to make it so if people put a decimal, it would get rid of that
[17:31:39] espressocannon: https://gist.github.com/ELI7VH/ef0101aae31acbe92872e1c3accb598e
[17:31:50] espressocannon: can you give me your thoughts onthis? is it still readable?
[17:33:47] guille-moe: has joined #ruby
[17:38:27] dmitriy_: has joined #ruby
[17:41:45] alfiemax: has joined #ruby
[17:42:43] havenwood: espressocannon: Much better--yeah, that's way more readable.
[17:43:06] havenwood: espressocannon: You can get rid of the parens around `number >= 1`.
[17:46:22] guille-moe1: has joined #ruby
[17:51:14] schneider: has joined #ruby
[17:59:16] raynold: has joined #ruby
[18:04:17] xco: has joined #ruby
[18:05:07] CodeBug: has joined #ruby
[18:06:46] cschneid: has joined #ruby
[18:12:06] patteh: has joined #ruby
[18:13:08] adlerdias: has joined #ruby
[18:33:45] sameerynho: has joined #ruby
[18:35:56] alfiemax: has joined #ruby
[18:38:23] morfin: if i do class Foo < Bar end for already existing class something change?
[18:39:50] morfin: ah i can't do this
[18:39:53] dmitriy_: has joined #ruby
[18:39:58] workmad3: has joined #ruby
[18:42:32] Mon_Ouie: You can do it only if class Foo is already a subclass of Bar
[18:43:31] karapetyan: has joined #ruby
[18:43:40] imode: has joined #ruby
[18:44:55] cschneid: has joined #ruby
[18:46:54] motstgo: has joined #ruby
[18:50:09] tAn: has joined #ruby
[18:51:18] tAn: has joined #ruby
[18:52:06] tAn: has joined #ruby
[18:52:23] schneider: has joined #ruby
[18:52:51] tAn: has joined #ruby
[18:57:33] orbyt_: has joined #ruby
[18:57:44] ayonkhan: has joined #ruby
[19:06:54] schneider: has joined #ruby
[19:11:01] detectiveaoi: has joined #ruby
[19:14:49] tAn: has joined #ruby
[19:16:42] phaul: has joined #ruby
[19:20:34] cschneid: has joined #ruby
[19:34:28] phaul: has joined #ruby
[19:36:15] alfiemax: has joined #ruby
[19:38:12] karapetyan: has joined #ruby
[19:38:43] orbyt_: has joined #ruby
[19:39:21] _aeris_: has joined #ruby
[19:39:26] Nicmavr: has joined #ruby
[19:45:01] pmullins: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[19:47:18] ltem: has joined #ruby
[19:50:36] alfiemax: has joined #ruby
[19:52:13] karapetyan: has joined #ruby
[19:52:48] milardovich: has joined #ruby
[19:53:21] Dimik: has joined #ruby
[19:53:30] Zaab1t: has joined #ruby
[19:56:37] banisterfiend: has joined #ruby
[20:01:12] goatish: has joined #ruby
[20:02:05] cschneid: has joined #ruby
[20:06:01] cdg: has joined #ruby
[20:07:28] tomphp: has joined #ruby
[20:13:52] cdg: has joined #ruby
[20:20:43] dinfuehr_: has joined #ruby
[20:29:26] segy: has joined #ruby
[20:29:47] alfiemax: has joined #ruby
[20:29:47] motstgo: has left #ruby: ("WeeChat 1.9")
[20:30:32] _aeris_: has joined #ruby
[20:36:06] bigblind: has joined #ruby
[20:36:42] jp: has joined #ruby
[20:37:18] tomphp: has joined #ruby
[20:39:02] banisterfiend: has joined #ruby
[20:39:27] cschneid: has joined #ruby
[20:40:18] workmad3: has joined #ruby
[20:49:54] milardovich: has joined #ruby
[20:53:08] za1b1tsu: has joined #ruby
[20:53:33] xco: has joined #ruby
[20:56:58] willmichael: has joined #ruby
[20:57:50] bigblind: has joined #ruby
[21:04:49] tvw: has joined #ruby
[21:11:06] milardovich: has joined #ruby
[21:16:30] roshanavand: has joined #ruby
[21:23:10] Frem: has joined #ruby
[21:24:57] alfiemax: has joined #ruby
[21:30:39] tomphp: has joined #ruby
[21:32:17] cschneid: has joined #ruby
[21:45:06] kn-928: has joined #ruby
[22:03:11] cschneid: has joined #ruby
[22:03:44] alfiemax: has joined #ruby
[22:04:41] bigblind: has joined #ruby
[22:08:51] adlerdias: has joined #ruby
[22:10:33] orbyt_: has joined #ruby
[22:18:53] rubemlrm: has joined #ruby
[22:20:37] willmichael: has joined #ruby
[22:30:20] tolerablyjake: has joined #ruby
[22:35:44] hahuang65: has joined #ruby
[22:36:27] nowhereman_: has joined #ruby
[22:37:19] hahuang65: has joined #ruby
[22:38:16] ledestin: has joined #ruby
[22:38:21] cschneid: has joined #ruby
[22:39:14] hahuang65: has joined #ruby
[22:40:47] workmad3: has joined #ruby
[22:42:02] alfiemax: has joined #ruby
[22:42:53] hahuang65: has joined #ruby
[22:55:48] tolerablyjake: has joined #ruby
[23:06:21] dviola: has joined #ruby
[23:10:49] zipace: has joined #ruby
[23:20:09] alfiemax: has joined #ruby
[23:22:00] tolerablyjake: has joined #ruby
[23:27:13] cschneid: has joined #ruby
[23:33:26] chatchatt: has joined #ruby
[23:33:48] hahuang65: has joined #ruby
[23:35:41] hahuang65: has joined #ruby
[23:37:31] alfiemax: has joined #ruby
[23:38:53] orbyt_: has joined #ruby
[23:42:29] mynameisdebian: has joined #ruby
[23:43:55] mynameisdebian: How can I set an ASCII counter with Ruby, where (for example) it prints 1, the 1 disappears, then it prints 2, the 2 disappears, then it prints 3, and so on? I would like to do this without clearing the screen each time (I just want to clear the line).
[23:44:18] hahuang65: has joined #ruby
[23:44:36] mynameisdebian: like, the counter changes, but always appears in the same spot
[23:45:22] DarthGandalf: has joined #ruby
[23:46:10] Flisk: mynameisdebian: 100.times { |i| STDOUT.write " #{i}\r"; sleep 1 }
[23:46:22] AJA4350: has joined #ruby
[23:46:26] Flisk: carriage return :)
[23:46:40] mynameisdebian: Flisk: nice one, thank you
[23:47:35] Flisk: works nicely if your number only ever grows
[23:58:44] schneider: has joined #ruby
[23:59:08] hahuang65: has joined #ruby