Method: RBench::Column#to_s
- Defined in:
- lib/rbench/column.rb
#to_s(val = title) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rbench/column.rb', line 14 def to_s(val=title) str = case val when Array then "%#{width-1}.2f" % (val[0] / val[1]) + "x" when Float then "%#{width}.3f" % val when Integer then "%#{width}.0f" % val when TrueClass then " "*(width/2.0).floor + "X" + " "*(width/2.0).floor when String then "%#{width}s" % (val)[0,width] when Object then " " * width end return " #{(str.to_s+" "*width)[0,width]} |" end |