class Hej attr_accessor :values def []=(key, v) self.values = *v end end h = Hej.new h[:koo] = 1 puts "h: #{h.values.inspect}"