# File lib/plugins/defaults/stdout.rb, line 40definitialize(ids)
ifnotids.kind_of?(Array)
raiseArgumentError, 'ids should be an Array'elsifids.empty?raiseArgumentError, 'ids should not be empty'end@ids = ids@table = {}
@rtable = {}
end
Public Instance Methods
get(id)click to toggle source
# File lib/plugins/defaults/stdout.rb, line 60defget(id)
@table[id]
end
get_id(data)click to toggle source
# File lib/plugins/defaults/stdout.rb, line 64defget_id(data)
@rtable[data] ||self.next(data)
end
next(data)click to toggle source
# File lib/plugins/defaults/stdout.rb, line 51defnext(data)
id = @ids.shift@ids.pushid@rtable.delete(@table[id])
@table[id] = data@rtable[data] = ididend