#ruby-lang - Sat 19 May 2007 between 00:22 and 03:13

NY Lost Funds



djmccormickanyone 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.
GaryKingHow do I enter new data into an item in an array where it's ID number is 2?
djmccormicksomething = 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
GaryKingdjmccormick: How do I do it to an existing array?
djmccormickGaryKing: http://pastie.caboo.se/62842
djmccormickanyone? 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)
djmccormickapeiros_: 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 :)
dcnstrctI 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
yvonin the background, it's still iterating however. You don't have to do the iteration yourself.
dcnstrctahh cool thanks for the info
gartoperhi
stouset1.8.6 is out?
1.8.6 is out!
G'nite, apeiros_'s computer.
hagabakais 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
kujahagabaka: 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.
hagabakaoh
kujaYou'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.
rueHey, kuja
kujaHey rue :)
hagabakahmm, actually join will flatten nested arrays
kujaWell, 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.
hagabakayeah
i'm going that way now. at first the data structure looked much too complex :p

Page: 2 9 16 

IrcArchive

NY Lost Funds