Hello,

just getting started into Ruby, I'm working with relative filenames as 
strings (e.g. "foo/bar/baz.bla") which I've to pass around a lot.

Sometimes I've those strings in simply arrays, sometimes I use them in a 
Hash as *keys*, sometimes I've a Set to avoid duplicates.

I can generate those filenames from various sources and now I like to 
attach a kind of meta data to that string: where it originated from (in 
terms of another string information, actually another relative filename 
but that's not obligation). Actually it will be just for the users 
convenience for error reporting.

I'm trying to get away without rewriting everything (which may not work 
anyway) but I'm unsure how to proceed. For my given use cases above, 
would could be suggested to do?

Should I create a new class? But could that fit into my "don't want to 
rewrite everything" approach?

Can I, when I receive a string the first time from a source, "just add" 
some meta data to it, which I can later retrieve? I'm thinking about 
JavaScript somehow, because there I can just add properties to an 
existing object.I tried that but it raised "undefined method 
`source_file='" exceptions.

Rewrite the filename handling stuff?

Here's an example method:

def find_shaders
     shaders = Set.new
     @map.entities.each { |entity|
         entity.brushes.each { |brush|
             brush.sides.each { |side|
                 side.shader ?
                 shaders.add(side.shader) :
                 nil
             }
         }
     }
     shaders
end

side.shader - string, like "texture/foo/bar"

The @map has a .source_file property which I would like to attach to the 
"side.shader" value somehow, without removing the behavior of the 
entries in the shaders-Set and without loosing the information.

Outside that method, it's like that that at some point the Set gets 
merged with another one, gets converted to an array, etc.

thanks,
- Markus