Time |
S |
Nick |
Message |
04:23 |
|
codex |
anyone around - i have a ruby question |
04:23 |
|
codex |
running into what looks like a bug |
04:24 |
|
codex |
if I do: t_p = `some-sys-command-that-outputs-lines-to-a-string` |
04:24 |
|
codex |
then, |
04:24 |
|
codex |
total_packages = t_p.each_line("\r").to_a |
04:24 |
|
codex |
total_packages = t_p.lines("\r") |
04:24 |
|
codex |
SHOULD be the same |
04:24 |
|
codex |
it lokos like the first works perfectly and the .lines one doesn't |
04:25 |
|
codex |
even per the doc it claims so: http://ruby-doc.org/core-2.0/String.html#method-i-lines |
04:26 |
|
codex |
and my second question, same t_p = `some-sys-command...`, but if you have "total_packages = []", why doesn't this work: t_p.each_line("\r") {|s| total_packages.push(s) } |
04:49 |
|
|
sivoais joined #sourcefu |
05:00 |
|
|
sivoais joined #sourcefu |
05:09 |
|
|
sivoais joined #sourcefu |
05:20 |
|
|
sivoais joined #sourcefu |
05:30 |
|
|
sivoais joined #sourcefu |
05:40 |
|
|
sivoais joined #sourcefu |
05:49 |
|
|
sivoais joined #sourcefu |
06:00 |
|
|
sivoais joined #sourcefu |
06:10 |
|
|
sivoais joined #sourcefu |
06:15 |
|
|
sivoais joined #sourcefu |
06:29 |
|
* aditsu |
doesn't ruby |
12:20 |
|
pdurbin |
codex: what if you leave out the ("\r") ? does it do what you want? |
12:36 |
|
pdurbin |
codex: have you seen http://ideone.com ? "Ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages." |
12:42 |
|
pdurbin |
i.e. http://ideone.com/b7xBSi |
12:53 |
|
codex |
pdurbin: oh interesting. No, I didn't know about that |
12:54 |
|
codex |
pdurbin: that should've said \n btw. The \r was from a previous problem :) |
12:55 |
|
codex |
pdurbin: http://ideone.com/bVDTaZ |
12:56 |
|
codex |
fails with #<Enumerator:0x8efed60> |
13:03 |
|
pdurbin |
fail: puts "one\ntwo\nthree".lines("\n") |
13:03 |
|
pdurbin |
pass: puts "one\ntwo\nthree".lines("\n").to_a |
13:03 |
|
pdurbin |
codex: right? |
13:04 |
|
codex |
yep |
13:04 |
|
pdurbin |
codex: you're wondering why you need to_a? |
13:04 |
|
codex |
pdurbin: but the .to_a should have a 'each_line' |
13:04 |
|
codex |
so not quite what you have there |
13:05 |
|
codex |
it would be: puts "one\ntwo\nthree".each_line("\n").to_a |
13:06 |
|
codex |
and that ^ and the 'fail' line you have should be identical. Infact, the .lines is supposedly an alias |
13:17 |
|
pdurbin |
codex: there's an example of input.lines.to_a.each{|line| issues << Issue.new(line)} at https://github.com/crimsonfu/code/blob/master/katas/autovivification/agoddard.rb |
13:44 |
|
|
rruma joined #sourcefu |
14:07 |
|
pdurbin |
codex: I'm looking forward to your solution :) |
14:18 |
|
|
sivoais joined #sourcefu |
15:20 |
|
codex |
pdurbin: what solution? |
15:20 |
|
codex |
it looks like a ruby bug to me |
15:40 |
|
codex |
pdurbin: the great folks in #ruby explained that it's a ruby 2.0 feature - somehow I had ruby 2.0 installed but my path on one system was calling ruby 1.8.7 |
16:03 |
|
ironcame1 |
there is also codepad.org |
16:24 |
|
pdurbin |
codex: a solution to the autovivication kata at https://github.com/crimsonfu/code |
16:24 |
|
pdurbin |
ironcame1: right, http://codepad.org . thanks |
16:25 |
|
pdurbin |
codex: and thanks for explaining |
18:52 |
|
|
agoddard joined #sourcefu |
18:52 |
|
agoddard |
pdurbin: ohai |
18:53 |
|
pdurbin |
agoddard: hey |
18:53 |
|
agoddard |
I forgot about sourcefu! :D |
18:54 |
|
* agoddard |
adds it, won't forget again! |
18:56 |
|
pdurbin |
how dare you |
21:11 |
|
pdurbin |
new! logstats — Summarize and Visualize Data in Log Files - jabrcx - http://jabrcx.github.io/logstats/ |
22:49 |
|
aditsu |
http://www.quickmeme.com/meme/3umaey/ |
22:56 |
|
pdurbin |
lol |
22:56 |
|
pdurbin |
aditsu: I'm glad you joined us :) |
22:56 |
|
pdurbin |
that's how I feel in ##shibboleth |
22:56 |
|
aditsu |
you should spell it shibboleet |
22:57 |
|
pdurbin |
heh |
22:57 |
|
aditsu |
what's the purpose of that channel? |
23:07 |
|
aditsu |
hmm, I wish great suffering upon... (*reads @author tags*) Arthur van Hoff, Michael McCloskey and Xueming Shen |
23:19 |
|
pdurbin |
One Div Zero: A Brief, Incomplete, and Mostly Wrong History of Programming Languages - http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html |
23:22 |
|
aditsu |
lol :) |
23:28 |
|
pdurbin |
mentioned at http://scalatypes.com/episode-5-interview-with-james-iry |