lib/administrate/field/number.rb in administrate-0.4.0 vs lib/administrate/field/number.rb in administrate-0.5.0

- old
+ new

@@ -5,25 +5,33 @@ class Number < Field::Base def to_s if data.nil? "-" else - format_string % data + format_string % value end end private def format_string - prefix + "%.#{decimals}f" + prefix + "%.#{decimals}f" + suffix end def prefix options[:prefix].to_s end + def suffix + options[:suffix].to_s + end + def decimals options.fetch(:decimals, 0) + end + + def value + data * options.fetch(:multiplier, 1) end end end end