Sha256: 44ff56496f63205a85bb51a91a89615fd091e103a7fb7452a7a2f3726ac574ab
Contents?: true
Size: 608 Bytes
Versions: 6
Compression:
Stored size: 608 Bytes
Contents
var format = (function() { var formatFloat = function(number, precision) { precision = precision || 2; var base = Math.pow(10, precision); return Math.round(number * base) / base; } var metricTemplate = '<div class="bar {{class}}" style="width: {{percent}}%">{{metric}}</div>'; var metric = function(e, max) { var max = (max || 1); var data = { 'class': e.state, 'percent': (e.metric / max * 100), 'metric': formatFloat(e.metric) } return Mustache.render(metricTemplate, data); }; return { 'float': formatFloat, 'metric': metric } })();
Version data entries
6 entries across 6 versions & 3 rubygems