Robert Klemme
8/20/2008 5:40:00 AM
On 19.08.2008 21:32, Pit Capitain wrote:
> I'm not Robert, but at least we both live in the same country, so I'll
> answer anyway:
Hm, Adgar has a yahoo.de address and you claim "we both live in the same
country" - in that case I'd say all of us three live in the same
country. :-))
> 2008/8/19 Adgar Marks <adgar.marks@yahoo.de>:
>> I read your answer and also tried it!
>
> If you really tried it, then you haven't looked at the result of the
> method #find. Just try each step in IRB and look at the results.
>> I read your remark:
>> "But note that this is inefficient if you have multiple entries in both
>> arrays."
>> whic is exaclty my case, which i tried to explain my writing:
>> ...
Good, then you probably want the nested Hash solution. Or rather create
a data structure for your data and put it into a Hash indexed by file
name, e.g.
FileData = Struct.new :file_name,
:year,
:month,
:day,
:suffix,
:j_day,
:size
dat = FileData.new splitLine[8], ...
I do not know what you do with that but storing the data as a Date is
probably better for consistency reasons.
>> i thought i explained my problem clearly, that my arrays are
>> multidimentions, by writing that they dont have the same size and
>> explain the structre of each Array of hashes.
Actually I'd say those Arrays are not multidimensional. Each Array
covers one dimension only but they contain complex structures (as
opposed to simple String or Fixnum).
> I'm sure Robert understands your problem exactly, but it seems you
> don't understand his answer, in which he mentioned a more efficient
> data structure: hashes of hashes.
This was probably my fault: I was a bit too brief. I should at least
have mentioned that the object in question is returned from #find.
There was just the small "hint" that I saved it in a variable. And I
also should have mentioned IRB... :-) Sorry for that, posting in a
hurry does not always yield good results.
Adgar, if you feel more comfortable with German there is also Usenet
group de.comp.lang.ruby.
Kind regards
robert