redefine [] operator in ruby
// the parameter must be an integer/fixnum
//
// i.e.
// def [](chunk)
// @internal_id_hash[chunk.chunk_id]
// end
// is not possible
class ChunkList .. def [](chunk_id) @internal_id_hash[chunk_id] end end
DZone Snippets > ovhaag > operator
11381 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Oliver Haag www.ohcon.de
class ChunkList .. def [](chunk_id) @internal_id_hash[chunk_id] end end