apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
_whitelogger has joined #ruby
<apeiros_> kah1: instead, you probably want: array1 = [] # <-- that assigns a new array, leaving the old one that you pushed to chapters untouched
<kah1> apeiros_: ah! ok ok, i'll try that!
<apeiros_> kah1: also `chapters = chapters.push array1` - don't do that. `chapters.push array1` is sufficient. (push modifies the array, it does not return a new, modified array)
<kah1> apeiros_: dude, thanks so much
<apeiros_> I also strongly suggest using a proper class. for what you're currently doing, a struct would suffice.
gregorg_taf has joined #ruby
<kah1> a what would suffice?
<apeiros_> a struct. give me a minute…
<kah1> apeiros_: cool thanks.
<apeiros_> you don't need ch_count either, you can ask the array for its size
<kah1> apeiros_: really that's cool
<kah1> really? *
<apeiros_> kah1: http://pastie.org/3663156 - there's more that could be changed. I tried not to change too much at once, so you can still track the changes.
statarb3 has joined #ruby
<apeiros_> oh, I made a small mistake, sorry, I'll paste again…
<apeiros_> reload, I fixed the bug.
<apeiros_> gah, second bug…
<kah1> apeiros_: dude that's fockin amazing!
<Tomasso> how do you get the current index when iterating on a collection? elem.key doesnt work
<apeiros_> meh, too many mistakes
<apeiros_> kah1: wait a minute, I'll remove the stupidities and repaste…
<apeiros_> Tomasso: how should elem.key work… elem is just the element, it has no idea it is in an array (could even be in multiple, what'd .key return then?)
<apeiros_> Tomasso: use each_with_index
<Tomasso> eheh yess xD
<Tomasso> let me check ..
<apeiros_> kah1: http://pastie.org/3663156 - this one actually runs, unlike before :)
<kah1> apeiros_: really, that code is unreal ahha
<kah1> apeiros_: i have to run, but man thanks so much!
hse-hoens has joined #ruby
<apeiros_> kah1: you're welcome. as said, there's still room for improvement
<kah1> apeiros_: haha, oh knowing me for sure haha
cobragoat has joined #ruby
<kah1> apeiros_: cheers man, i'll be around
<apeiros_> I won't be around for much longer. 0100 here, gotta go kiss the pillow
<apeiros_> but I'm often here
jesly has joined #ruby
<apeiros_> kah_: http://pastie.org/3663189 here's an alternative for the last few lines
<apeiros_> not exactly the same formatting as yours, though
bikcmp has joined #ruby
<bikcmp> hi all, where does ruby keep it's libraries at?
<bikcmp> eh, perhaps gem
<apeiros_> bikcmp: libraries: puts $LOAD_PATH
<apeiros_> gems: puts Gem.path
Guest23751 has joined #ruby
`brendan has joined #ruby