I'm not a fan of this map approach, you're hiding an if type == 'csv' use this function. Right now you're supporting a single type of format so you don't need a map at all (remember the motto if you don't need it you don't build it). Anyway I would approach this kind of problem by embracing duck typing, what matters is having an object which can respond to the message export_measures. For example by having CsvExport, PdfExport or WhateverExport that provide export_measures.