| djmccormick | anyone mind taking a look at this issue? http://pastie.caboo.se/62835 (erb):10: undefined local variable or method `send_this' for main:Object (NameError) its just like http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/ except it's in a method, but i'm getting errors. |
| GaryKing | How do I enter new data into an item in an array where it's ID number is 2? |
| djmccormick | something = Array.new; something[2] = 'bob' anyone mind taking a look at why i can't access this variable in my RHTML using ERB? http://pastie.caboo.se/62835 |
| GaryKing | djmccormick: How do I do it to an existing array? |
| djmccormick | GaryKing: http://pastie.caboo.se/62842 |
| djmccormick | anyone? check out my prob? http://forums.devshed.com/ruby-programming-142/erb-undefined-local-variable-or-method-446086.html |
| apeiros_ | djmccormick, you have to run it in the binding of your serve_html method djmccormick, that's actually mentioned quite close to the top of the ERB documetation template.result(binding) |
| djmccormick | apeiros_: i could swear i had that earlier and it didn't work, but it was probably another issue at the time. that works. thanks a million for checking it out :) |
| dcnstrct | I have two lists that have the same number of elements, now I want to turn this into a single hash, is there a quick way ? I mean I know I can iterate over one line, and assign values to a hash from another list, but I'm guessing there is some method to do this already s/line/list |
| apeiros_ | there isn't you can use keys.zip(values) { ... } dcnstrct, http://pastie.caboo.se/62847 |
| yvon | in the background, it's still iterating however. You don't have to do the iteration yourself. |
| dcnstrct | ahh cool thanks for the info |
| gartoper | hi |
| stouset | 1.8.6 is out? 1.8.6 is out! G'nite, apeiros_'s computer. |
| hagabaka | is there an easy way to extract all the strings in a complex data structure? for example, [{:a => 'abc'; :b => ['def', 'ghi', 'jkl'], :c => {:d => 'mno', :e => ['pqr', 'st']}}, 'uvr'] would give 'abcdefghi...' with a custom delimiter too |
| kuja | hagabaka: Using a recursive method that calls #find_all, passes it the result it self to be used as the iterable object, and #flatten to flatten out all the strings that were #find_all'ed I don't know if it's the best way, though. |
| hagabaka | oh |
| kuja | You'd also have to check if the object responds to find_all. But, just because it doesn't respond to find_all doesn't mean it isn't iterable, so it might be safer to use #each instead. |
| rue | Hey, kuja |
| kuja | Hey rue :) |
| hagabaka | hmm, actually join will flatten nested arrays |
| kuja | Well, that works too. Also consider whether the objects must be a string, or if they must be something that can act as a string (i.e., do they respond to #to_s) hagabaka: It might be easier if you know exactly what sort of objects are stored in what sort of "complex" structures and how complex the structures are. |
| hagabaka | yeah i'm going that way now. at first the data structure looked much too complex :p |